Troubleshooting Mbed Python Errors

If you encounter problems importing or building mbed projects, please try resetting your Python environment as shown on this page.

  1. Clear the Tools->Options->VisualGDB->General->Tools->Python Directory setting:
  2. Delete the %LOCALAPPDATA%\VisualGDB\Python* directories.
  3. Restart Visual Studio and open the Mbed Project Wizard. When prompted to install Python, try installing the latest Python 3:This will install a version of Python that was tested with mbed scripts on our side, and it should work exactly as described in our mbed tutorials.
  4. If you still get an error while trying to clone an mbed repository, the selected mbed version might be referencing packages that are not available in the currently used Python version. If this happens, click the “Show output from failed command” link in the error message shown by VisualGDB:The log will contain output similar to the one shown below:

    Take a note of the following parameters:

    1. Python executable used to run the command (in this example, C:\Users\virtual.SYSPROGS\AppData\Local\VisualGDB\Python3\python.exe)
    2. The requirements file (in this example, c:\projects\temp\MbedProject2\mbed-os\requirements.txt)
    3. The exact package versions that failed (in this example, pywin32==224) and the available versions (in this example, 225..302)
  5. In order to make that mbed version work, you will need to adjust the requirements.txt file to reference the nearest package version provided by your Python distro. In this example, it would mean replacing the following line in requirements.txt:

    with the following one:
  6. Now you can re-run the “mbed update” command as shown in the log file, e.g.:
  7. Now you can import the manually patched mbed checkout into VisualGDB by selecting the “import” mode in the wizard: