scientifichackers / ampy

MicroPython Tool - Utility to interact with a MicroPython board over a serial connection.
MIT License
723 stars 157 forks source link

I can run my main.py (blinky_1.py) test but the put command does not work #119

Open Timon-E opened 1 year ago

Timon-E commented 1 year ago

I am using an Arduino Nano 33 BLE and generating my .py file using openMV IDE

When I use the run command from ampy it gives me this error but successfully runs my script and correctly blinks the LED's.

PS C:\Users\Achtu\OneDrive\Documents\OpenMV> ampy --port COM8 run main.py Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Scripts\ampy.exe__main.py", line 7, in File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\cli.py", line 338, in run output = board_files.run(local_file, not no_output, not no_output) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\files.py", line 309, in run self._pyboard.execfile(filename, streamoutput=True) File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\pyboard.py", line 285, in execfile return self.exec(pyfile, stream_output=streamoutput) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\pyboard.py", line 277, in exec ret, ret_err = self.exec_raw(command, data_consumer=data_consumer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\pyboard.py", line 265, in exec_raw self.exec_raw_no_follow(command); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\pyboard.py", line 262, in exec_raw_no_follow raise PyboardError('could not exec command') ampy.pyboard.PyboardError: could not exec command

When I run the put command I get this error and the LED's do not blink.

PS C:\Users\Achtu\OneDrive\Documents\OpenMV> ampy --port COM8 put main.py Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Scripts\ampy.exe__main.py", line 7, in File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\cli.py", line 264, in put board_files.put(remote, infile.read()) File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\files.py", line 223, in put self.pyboard.exec("f.write({0})".format(chunk)) File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\pyboard.py", line 279, in exec_ raise PyboardError('exception', ret, ret_err) ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n File "", line 1, in \r\nOSError: 28\r\n')

If I try to get the boot.py I get this error and it says there is not boot.py

PS C:\Users\Achtu\OneDrive\Documents\OpenMV> ampy --port COM8 get boot.py Traceback (most recent call last): File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\files.py", line 74, in get out = self.pyboard.exec(textwrap.dedent(command)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\pyboard.py", line 279, in exec_ raise PyboardError('exception', ret, ret_err) ampy.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n File "", line 4, in \r\nOSError: [Errno 2] ENOENT\r\n')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Scripts\ampy.exe__main.py", line 7, in File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\cli.py", line 126, in get contents = board_files.get(remote_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Achtu\AppData\Local\Programs\Python\Python311\Lib\site-packages\ampy\files.py", line 80, in get raise RuntimeError("No such file: {0}".format(filename)) RuntimeError: No such file: boot.py

Any help would be appreciated. I am rather new to coding but I am giving it my best shot.