Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1053

UnicodeDecodeError: 'utf-8' when debugging Python files in PyCharm Community

$
0
0

Current conclusion:

The encoding of the converted file is utf-8->utf-8 big->ansi -> utf-8. Reopen the file after each conversion.

After observing for a period of time, there is no such error.


When I use PyCharm to debug .py files, the same file sometimes has UnicodeDecodeError, sometimes it’s normal. My operating system is Windows 10, PyCharm version is 2020.3.3 Community edition.

The error is as follows:

Traceback (most recent call last):  File "D:\Program Files\JetBrains\PyCharm Community Edition 2020.3.3\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 301, in _on_run    r = r.decode('utf-8')UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 1022-1023: unexpected end of data

I tried to add the following code to the header of the file, but sometimes I still get an error, how to solve it?

#!/usr/bin/env Python# coding=utf-8

I found another way to save as a UTF-8 document with Notepad. I tried it, but there are still errors sometimes.


Viewing all articles
Browse latest Browse all 1053

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>