BradenM / micropy-cli

Micropython Project Management Tool with VSCode support, Linting, Intellisense, Dependency Management, and more!
https://micropy-cli.readthedocs.io
MIT License
314 stars 25 forks source link

UnicodeDecodeError on micropy init in Windows #31

Closed ghost closed 5 years ago

ghost commented 5 years ago

I have install micropy-cli 1.1.2 on my Windows 10 (x64) where also python 3.7.3 (x64) is installed. "Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information."

When I perform the following command "micropy-cli init test", I get the following error. I have also tried the same error on another PC.

Imicropy init test Traceback (most recent call last): File "c:\users\flemm\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\flemm\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Flemm\AppData\Local\Programs\Python\Python37\Scripts\micropy.exe__main.py", line 9, in File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 764, in call return self.main(args, kwargs) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 717, in main rv = self.invoke(ctx) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 555, in invoke return callback(args, **kwargs) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\cli.py", line 54, in init mp = MicroPy() File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\main.py", line 24, in init__ self.setup() File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\main.py", line 36, in setup self.log.debug(f"Creating .micropy directory @ {self.FILES}") File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\logger.py", line 274, in debug return self.debug(msg, **kwargs) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\logger.py", line 275, in debug self.echo(msg, log="debug") File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\logger.py", line 165, in echo message, clean = self.parse_msg(msg, accent_color) File "c:\users\flemm\appdata\local\programs\python\python37\lib\site-packages\micropy\logger.py", line 111, in parse_msg clean = clean.encode('ascii', 'ignore').decode('unicode_escape') UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 32-33: truncated \UXXXXXXXX escape

BradenM commented 5 years ago

Hi @fpe,

Thanks for bringing this to my attention. This issue appears to only be reproducible in a Windows environment, as the problem arises when micropy-cli tries to write to its log file with a string that contains a Windows path.

I've opened up a PR (#32) that fixes this issue, and will merge and release 1.1.3 shortly.

Also, please be aware that micropy will be creating symbolic links when generating a new project. Depending on your environment, Windows may require micropy-cli to be run in an administrative prompt to be able to do this. See this for more info.

I will close this for now, but feel free to reopen if the problem persists. Thanks!