Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80759

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 308: character maps to <undefined>

X-Received by 10.236.39.174 with SMTP id d34mr19394024yhb.54.1415966244956; Fri, 14 Nov 2014 03:57:24 -0800 (PST)
X-Received by 10.140.37.83 with SMTP id q77mr37568qgq.7.1415966244934; Fri, 14 Nov 2014 03:57:24 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!u7no1604865qaz.1!news-out.google.com!m4ni191qag.1!nntp.google.com!i13no1605247qae.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Fri, 14 Nov 2014 03:57:24 -0800 (PST)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=116.202.20.19; posting-account=ESMvWgoAAACN3co-ywvI3f_Kki2ooOjY
NNTP-Posting-Host 116.202.20.19
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <0a5917ca-70f3-4297-9e98-e8ed0556ee22@googlegroups.com> (permalink)
Subject UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 308: character maps to <undefined>
From satishmlmlml@gmail.com
Injection-Date Fri, 14 Nov 2014 11:57:24 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1792
X-Received-Body-CRC 2513881745
Xref csiph.com comp.lang.python:80759

Show key headers only | View raw


For 'mimetypes' in the code given below, python is giving the following error. Kindly help.

>>> import os
>>> matches = []
>>> for (dirname, dirshere, fileshere) in os.walk(r'C:\Python34'):
	for filename in fileshere:
		if filename.endswith('.py'):
			pathname = os.path.join(dirname, filename)
			if 'mimetypes' in open(pathname).read():
				matches.append(pathname)

				
Traceback (most recent call last):
  File "<pyshell#165>", line 5, in <module>
    if 'mimetypes' in open(pathname).read():
  File "C:\Python34\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 308: character maps to <undefined>

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 308: character maps to <undefined> satishmlmlml@gmail.com - 2014-11-14 03:57 -0800
  Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 308: character maps to <undefined> Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-14 07:30 -0500

csiph-web