D
D
Denis99992015-12-21 09:20:49
Python
Denis9999, 2015-12-21 09:20:49

Problems with encoding in Python 3?

I write in python webdriver, the program enters the site, copies the text from the body and displays it on the command line. I checked it on two sites, on one everything worked without problems, but on the one it needs it does not work and such an error pops up, while both have the meta charset = "utf-8" encoding:

Traceback (most recent call last):
  File "ah.py", line 40, in <module>
    print (t.text)
  File "C:\Python34\lib\encodings\cp866.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u27a1' in position
403: character maps to <undefined>

Tell me, please, what is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-12-21
@deliro

The console is encoded cp866. It is hemorrhoid to change it, it's easier to write a log to a file. And more correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question