1 year ago

#172436

test-img

Kent Chen

Why I'm getting "UnicodeEncodeError: charmap' codec can't encode characters in position 24-25: character maps to <undefined>?

When I ran the Doctests with Coverage in PyCharm, I got the following error:

Testing started at 12:25 AM ...
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2021.3.1\plugins\python\helpers\coverage_runner\run_coverage.py", line 34, in <module>
    a_file.write(os.getcwd()+"\n")
  File "C:\Users\kent8\anaconda3\envs\MyDjangoEnv\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 24-25: character maps to <undefined>

I'm using python 3.10.1 and UTF-8 in vs code. How to solve this?

pycharm

doctest

python-3.10

0 Answers

Your Answer

Accepted video resources