Python
Python copied to clipboard
Invalid utf characters in linux
This is the error when trying to execute a file in Linux that has been made in Linux.
Traceback (most recent call last):
File "/opt/LightTable/plugins/python/py-src/ltmain.py", line 191, in handleEval
code= compile(code, data[2]["name"], 'exec')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-12: ordinal not in range(128)
I have exactly same issue in Windows7. Folder where the file opened is contains python files with unicode characters. All files were made in windows. I cant see this bug when I open file and trying to evaluate it (just nothing works), but if I add python connection to the folder with my project and then try to evaluate my file (without unicode characters in itself, only in other files in folder) I am getting exactly same error.
Same problem here; working on Ubuntu 14.04, fresh install of latest LightTable as of 14 Jan 2015 (LightTable version 0.7.2, binary version 0.8.6).
I have the same problem here, but I have something that seems to be a workaround. Adding one of the following the the first or second line of the Python code (depending on the encoding used) seems to work for me:
# -*- coding: ascii -*-
OR
# -*- coding: utf-8 -*-
Based on: https://www.python.org/dev/peps/pep-0263/