Skip to content

Running in Python 3 attempts to use raw_input #869

@arskanov

Description

@arskanov

Hi,

I ran into this issue while trying out mbed-cli 1.9.1 on python3.5. Mbed-OS version 5.11.5.
Script fails in the following way:

> mbed publish
[mbed] WARNING: If you're using Python 3 with Mbed OS 5.8 and earlier versions, Python errors will occur when compiling, testing and exporting
---
[mbed] Working path "/home/aramanen/work/mbedtest" (program)
[mbed] Checking for local modifications...
[mbed] Uncommitted changes in program "mbedtest" in "/home/aramanen/work/mbedtest"
[mbed] ERROR: Unknown Error: name 'raw_input' is not defined
---
[mbed] WARNING: Using Python 3 with Mbed OS 5.8 and earlier can cause errors with compiling, testing and exporting
---

The error is on this this line, and fails since raw_input() is input() in py3.

    if repo.dirty():
        action("Uncommitted changes in %s \"%s\" in \"%s\"" % (repo.pathtype(repo.path), repo.name, repo.path))
        if msg:
            repo.commit(msg)
        else:
            if sys.version_info[0] == 3:
                input('Press enter to commit and publish: ')
            else:
                raw_input('Press enter to commit and publish: ')
            repo.commit()

Seems to make it work fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions