Replies: 2 comments 1 reply
-
As far as I can tell It would be great if |
Beta Was this translation helpful? Give feedback.
1 reply
-
PR: #15332 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A syntax error is thrown when an attempt is made to create a directory ending in a
\r
The problem only occurs when the sd card is inserted ,
mip install
works fine with the same setup - but without the sd card - but then there is insufficient room for the rest of the processingFull Error trace
``` py $ mpremote mip install github:josverl/micropython-stubber/mip/mpy_v6.json Install github:josverl/micropython-stubber/mip/mpy_v6.json Installing github:josverl/micropython-stubber/mip/mpy_v6.json to /sd/lib /createstubs.mpylib Traceback (most recent call last): File "/home/jos/.local/bin/mpremote", line 8, in sys.exit(main()) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/main.py", line 528, in main handler_func(state, args) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/mip.py", line 184, in do_mip _install_package( File "/home/jos/.local/lib/python3.10/site-packages/mpremote/mip.py", line 147, in _install_package _install_json(transport, package, index, target, version, mpy) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/mip.py", line 109, in _install_json _download_file(transport, _rewrite_url(url, version), fs_target_path) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/mip.py", line 79, in _download_file _ensure_path_exists(transport, dest) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/mip.py", line 33, in _ensure_path_exists transport.fs_mkdir(prefix) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/transport_serial.py", line 427, in fs_mkdir self.exec("import os\nos.mkdir('%s')" % dir) File "/home/jos/.local/lib/python3.10/site-packages/mpremote/transport_serial.py", line 287, in exec raise TransportError("exception", ret, ret_err) mpremote.transport.TransportError: ('exception', b'', b'Traceback (most recent call last):\r\n File "", line 2\r\nSyntaxError: invalid syntax\r\n') ```
I think the actual error is in the choice to use
join and split("\n")
,The string that is returned does not contain a single
\n
but uses\r\n
as the newline separators ( as is standard in the MicroPython repl)With the current code the result is
(return) SerialTransport.exec: b'/sd/lib\r\n/flash/lib\r\n'
lib_path = ['/sd/lib\r', '/flash/lib']
Please notice that there now is a lingering
\r
after the first lib_pathsI think the best fix for this would be to use another separator that cannot, or is unlikely to be used in a path ; such as "|",
rather than work around the (CR)(LF) differences, but both can work.
@jimmo Happy to create a PR , but wanted to check first if there is more to this than I could see.
Beta Was this translation helpful? Give feedback.
All reactions