Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mainsail.cfg unicode symbol issue #32

Open
UserDmitry opened this issue Feb 8, 2024 · 4 comments
Open

mainsail.cfg unicode symbol issue #32

UserDmitry opened this issue Feb 8, 2024 · 4 comments

Comments

@UserDmitry
Copy link

Klipper report an issue "Unable to open *path*\mainsail.cfg file". In klippy.log there is a error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7558: ordinal not in range(128)
Config error
Traceback (most recent call last):
File "/home/sapphire/klipper/klippy/configfile.py", line 159, in _read_config_file
data = f.read()
File "/home/sapphire/klippy-env/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7558: ordinal not in range(128)

This byte appears at str. number 137:
# we need to use the unicode (\u00B0) for the ° as py2 env's would throw an error otherwise

Unicode symbol in this comment " ° " cause this error.

@pedrolamas
Copy link
Contributor

I've tried to reproduce this issue on a Docker container running Python 2.7.18 and it worked fine...

@UserDmitry can you please upload a full klippy.log so we can check the issue directly?

@UserDmitry
Copy link
Author

Yes, of course.
klippy.log

@pedrolamas
Copy link
Contributor

Looking at the log I can see Klipper is using python 3.6.9, so that might be the problem as AFAIK, unicode support was added in 3.9.

Nevertheless, I do think we should fix this issue here as it is such a trivial fix.

@zellneralex any comments on this?

@zellneralex
Copy link
Member

I really love it, I am only adding that comment so that people understand the cryptic Unicode usage here. I will change the comment in the next days.

Currently I am on a business trip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants