问题描述
它引用。
我与Python 3.3和Pycharm 2.7.2相同的问题
尝试在代码中硬编码编码,手动指定Pycharm选项中的编码,但不起作用。它仍然尝试用cp1251 lib打开utf-8文件。
Its a reference to UnicodeDecodeError while using cyryllic . I have same problem with Python 3.3 and Pycharm 2.7.2Tryed to hardcode encoding in code, manually specifying encoding in Pycharm options, but no effect. It still tries to open utf-8 file with cp1251 lib.
Connected to pydev debugger (build 129.314)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 2.7.2\helpers\pydev\pydevd.py", line 1481, in <module>
debugger.run(setup['file'], None, None)
File "C:\Program Files (x86)\JetBrains\PyCharm 2.7.2\helpers\pydev\pydevd.py", line 1124, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm 2.7.2\helpers\pydev\_pydev_execfile.py", line 33, in execfile
contents = stream.read()
File "C:\Python33\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 2839: character maps to <undefined>
在调试跟踪器中这个问题标记为已解决,但它仍然在这里。
In debug tracker http://youtrack.jetbrains.com/issue/PY-3669 this problem marked as solved, but its still here.
任何建议?
推荐答案
该版本的示例代码对我来说适用于Python 3.3和PyCharm 2.7。 3(2行:
The sample code from that ticket worked fine for me with Python 3.3 and PyCharm 2.7.3 (2 lines:
# -*- coding: utf-8 -*-
print("януари")
)。
是否适合您?
您是否使用远程调试器?
Do you use remote debugger?
还有一个可能涉及的开放式错误:
There is another one open bug that could be related: http://youtrack.jetbrains.com/issue/PY-10241
这篇关于PyCharm调试器中的UnicodeDecodeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!