Python Forum

Full Version: UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 23: c
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I try to run my code in cmd command. It ran few lines of my code and gave some en code error. I posted the output below. Does anyone know why this happens? Thanks in advance.

Output:
C:\Users\resea>"C:\Users\resea\Desktop\Python Projects\ecb try 3.py" Mario Draghi, President of the ECB,Vítor Constâncio, Vice-President of the ECB,Frankfurt am Main, 10 January 2013 Get an overview of what the European Central Bank does and how it operates. More Look at press releases, speeches and interviews and filter them by date, speaker or activity. More Traceback (most recent call last): File "C:\Users\resea\Desktop\Python Projects\ecb try 3.py", line 51, in <module> print (" ".join(colored_words)) File "C:\Python34\lib\site-packages\colorama\ansitowin32.py", line 41, in write self.__convertor.write(text) File "C:\Python34\lib\site-packages\colorama\ansitowin32.py", line 162, in write self.write_and_convert(text) File "C:\Python34\lib\site-packages\colorama\ansitowin32.py", line 190, in write_and_convert self.write_plain_text(text, cursor, len(text)) File "C:\Python34\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text self.wrapped.write(text[start:end]) File "C:\Python34\lib\encodings\cp850.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in position 23: character maps to <undefined>
Quote:Does anyone know why this happens?
How could we know Confused
You need to post ecb try 3.py.
Obviously there is a problem with a string that the colorama module is unable to print because of en encoding issue. You could print the repr of this string, so we could look at this with colorama. Try to print the repr(" ".join(colored_words)) at line 51 in ecb try 3.py and post the result here.