python33, windows, UnicodeEncodeError: 'charmap' codec can't encode characters in position, to print out the file contents to stdout,

gintare g.statkute at gmail.com
Sun Jul 6 04:45:44 EDT 2014


I run python33 scrupt SVtxt.py from Windows command line
I want to print out the file contents to stdout. 

File contents: "Vi kan inte längre underordna den vinster..."

Python script sentences i have tries to use:
f=open('C:\Python33\Scripts\lang\langu\svtxt.txt','r')
linef=f.readlines()
f.close()
print(linef)#gives error
print(linef).decode("utf-8","ignore")#gives error

ERROR:
c:\Python33\Scripts\lang\langu>python SVtxt.py
Traceback (most recent call last):
  File "SVtxt.py", line 8, in <module>
    print(linef).decode("utf-8","ignore")
  File "C:\Python33\lib\encodings\cp437.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 91-92:



More information about the Python-list mailing list