Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnicodeDecodeError in PyCharm debugger

Its a reference to UnicodeDecodeError while using cyryllic . I have same problem with Python 3.3 and Pycharm 2.7.2 Tryed 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.

Any suggestions ?

like image 861
Alex T Avatar asked Sep 16 '13 12:09

Alex T


People also ask

How do I enable debugging actions in PyCharm?

Just right-click any line in the editor and select the Debug <filename> command from the context menu. After the program has been suspended, use the debugger to get the information about the state of the program and how it changes during running.

Can you Debug in PyCharm?

In PyCharm debugger, you can preview int variables in the hexadecimal or binary format. This might be particularly helpful when you debug network scripts that include binary protocols.


1 Answers

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("януари")

).

Does it work for you?

Do you use remote debugger?

There is another one open bug that could be related: http://youtrack.jetbrains.com/issue/PY-10241

like image 66
Ekaterina Blatova Avatar answered Oct 17 '22 05:10

Ekaterina Blatova