Running code with ampy or rshell or REPL?

  • I'm trying to streamline the debug cycle. Since vscode doesn't have a serial console (does it?) I run my code from there, it fails, then I have to stop that, go to putty, see what the error was, quit putty, reconnect vscode...

    I tried a couple of suggestions I found here: ampy & rshell, but couldn't get them to work.

    I have a file /flash/apps/ I can't seem to run it. If I start rshell, there's no run command. If I try using the shell command:

    cd /flash/apps

    It opens the file in vscode. But since vscode isn't connected to the com port, the run icon doesn't work.

    From ampy, the run command can't seem to find imports, but when I run from vscode or via the apps interface on the m5stickC, it works just fine. My imports:

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import imu
    import wifiCfg


    ampy -pcom4 run
    Traceback (most recent call last):
      File "c:\python36\lib\", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "c:\python36\lib\", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Python36\Scripts\ampy.exe\", line 7, in <module>
      File "c:\python36\lib\site-packages\click\", line 764, in __call__
        return self.main(*args, **kwargs)
      File "c:\python36\lib\site-packages\click\", line 717, in main
        rv = self.invoke(ctx)
      File "c:\python36\lib\site-packages\click\", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\python36\lib\site-packages\click\", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "c:\python36\lib\site-packages\click\", line 555, in invoke
        return callback(*args, **kwargs)
      File "c:\python36\lib\site-packages\ampy\", line 337, in run
        output =, not no_output)
      File "c:\python36\lib\site-packages\ampy\", line 303, in run
        out = self._pyboard.execfile(filename)
      File "c:\python36\lib\site-packages\ampy\", line 273, in execfile
        return self.exec_(pyfile)
      File "c:\python36\lib\site-packages\ampy\", line 267, in exec_
        raise PyboardError('exception', ret, ret_err)
    ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>", line 6, in <module>\r\n  File "flowlib/lib/", line 3, in <module>\r\nImportError: cannot import name cfgRead\r\n')

  • Oh, I can:

    import apps.purple_air as pa

  • Vcode does have a series console that you can use to run REPL through.

  • You could also try Mu. It may not have all the features that vscode has but it has a nice clean interface and works for transferring files between computer and m5stack, REPL, and has autocomplete for micropython base modules, i made a video on it a couple of weeks ago

  • @lukasmaximus I read that Mu requires 1.5.0, and I also read that it isn't out yet for the M5StickC.
    @ajb2k3 I sure haven't been able to find it!

  • @ajb2k3 Adding to this: I'm using the pymakr extension to VS Code. It handles selective code upload (only changed ones).

    Note that pymakr does not handle binary file transfer eg. jpg.