micropython-ide-vscode
micropython-ide-vscode copied to clipboard
Error Using Run Command
Hi! I'm unable to use the Run command. When I execute it, all I get is the following:
Checking current script...
Preparing file /Users/Richard/Desktop/ILDS/ILDS/.micropythonrc...
Checking `ampy` tool...
Checking `rshell` tool...
Reading settings from config file (.micropythonrc)...
Checking config file...
Checking `ampy` path config...
Checking `rshell` path config...
Checking upload port config...
Connect device from port /dev/cu.wchusbserial1420...
Reading baud rate config...
Using baud rate: 115200
Using port: /dev/cu.wchusbserial1420
Stopping running script if available...
Removing boot.py...
Searching for ignored files and directories...
Sending /boot.py...
Sending /main.py...
Reseting state...
Error: Command failed: export LANG="en_US.UTF-8" && /usr/local/bin/ampy --port /dev/cu.wchusbserial1420 --baud 115200 reset
Traceback (most recent call last):
File "/usr/local/bin/ampy", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/ampy/cli.py", line 292, in reset
_board.enter_raw_repl()
File "/usr/local/lib/python2.7/site-packages/ampy/pyboard.py", line 192, in enter_raw_repl
raise PyboardError('could not enter raw repl')
ampy.pyboard.PyboardError: could not enter raw repl
Task abort with 65084 milliseconds.
What's interesing is that when I run export LANG="en_US.UTF-8" && /usr/local/bin/ampy --port /dev/cu.wchusbserial1420 --baud 115200 reset
in my Terminal.app, it works just fine. Do you have any idea why that might be and how to fix it?
Modifying $HOME/.local/lib/python3.7/site-packages/ampy/pyboard.py
worked for me. In the enter_raw_repl
function, find the following block and add a time.sleep(2)
after it:
while n > 0:
self.serial.read(n)
n = self.serial.inWaiting()
time.sleep(2) # this should fix it
specifying a delay with -d does the trick for me:
ampy -d 0.5 -p /dev/cu.wchusbserial1410 -b 115200 run <<file.py>>