pycom icon indicating copy to clipboard operation
pycom copied to clipboard

Language accent marks are causing UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 10: invalid start byte

Open vegax87 opened this issue 3 years ago • 3 comments

Everytime I try to compile any python file with pycom, it gives me this error, I think it's related to language accent marks in the system language because I haven't used any of these in my python file and I've also checked that I was using UTF-8 in Notepad++


PS F:\pycom> pycom .\fibonacci.py
Traceback (most recent call last):
  File "C:\Users\\AppData\Local\Programs\Python\Python310\Scripts\pycom-script.py", line 33, in <module>
    sys.exit(load_entry_point('pycom', 'console_scripts', 'pycom')())
  File "F:\pycom\src\pycom\main.py", line 199, in main
    run_compile(flags=parsed_args)
  File "F:\pycom\src\pycom\main.py", line 97, in run_compile
    errorstr = errors.cpperrortopycomerror(error.decode(
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 10: invalid start byte

vegax87 avatar Jul 31 '22 23:07 vegax87

It's an issue with the platform you're on (win32)... the character set might be incomplete. Try using CygWin.

I haven't used any of these in my python file

It's due to characters in a C++ compiler error message (take note of the cpperrortopycomerror()), not from your script.

AnonymouX47 avatar Aug 01 '22 03:08 AnonymouX47

The platform should not be an issue. It'll likely that some file is saved with other encoding but code is assumes it's utf-8

0dminnimda avatar Aug 01 '22 09:08 0dminnimda

Oh yeah, it's not about files at all, the problem is in the error.decode('utf-8')

On the line 97 the code is trying to decode a bytes from stderr and it can't decode those as utf-8, not surprisingly

0dminnimda avatar Aug 01 '22 12:08 0dminnimda