How to transfer code properly via REPL paste mode?
Posted: Fri Mar 30, 2018 11:45 am
MicroPython code deployment is different in various boards. For some reason, My ESP8266 doesn't work any more for webREPL, even I reflash the stable firmware time by time.
And I have to test the code via serial. It is possible to paste the code via REPL, and save the pasted code string into a file in filesystem and get it runing.
But I find an issue for this mode. No matter Ctrl-A for raw REPL mode or Ctrl-D paste mode, the '\r\n' or '\x0D\x0A' will be converted into real return and newline anyway. When this string is saved into filesystem, the python code has syntax error.
For example:
'''
if not line or line == b'\r\n':
break
'''
will be saved as:
'''
if not line or line == b'
: break
'''
The latter will be invalid python code.
Now I can not get them works. Sad.
And I have to test the code via serial. It is possible to paste the code via REPL, and save the pasted code string into a file in filesystem and get it runing.
But I find an issue for this mode. No matter Ctrl-A for raw REPL mode or Ctrl-D paste mode, the '\r\n' or '\x0D\x0A' will be converted into real return and newline anyway. When this string is saved into filesystem, the python code has syntax error.
For example:
'''
if not line or line == b'\r\n':
break
'''
will be saved as:
'''
if not line or line == b'
: break
'''
The latter will be invalid python code.
Now I can not get them works. Sad.