[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-29 Thread Tim Golden

Tim Golden added the comment:

Fixed by issue9291

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-22 Thread Tim Golden

Tim Golden added the comment:

This looks like a duplicate of issue9291; could you test the latest patch over 
there, please?

--
assignee:  -> tim.golden
nosy: +tim.golden

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The unlinked push message was for #21139.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-21 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
Removed message: http://bugs.python.org/msg216987

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 374746c5dedc by Terry Jan Reedy in branch '2.7':
Issue #21138: Change default reformat paragraph width to PEP 8's 72.
http://hg.python.org/cpython/rev/374746c5dedc

New changeset dd24099c0cf6 by Terry Jan Reedy in branch '3.4':
Issue #21138: Change default reformat paragraph width to PEP 8's 72.
http://hg.python.org/cpython/rev/dd24099c0cf6

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-02 Thread tanbro

tanbro added the comment:

and in line 249, changes:

if isinstance(ctype, unicode):
ctype = ctype.encode(default_encoding) # omit in 3.x!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21138] mimetypes.MimeType UnicodeDecodeError

2014-04-02 Thread tanbro

New submission from tanbro:

when new a mimetypes.MimeType instance in a my Windows, whose default coding is 
mbcs, UnicdeDecodeError occurred.

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> from mimetypes import MimeTypes
>>> mt = MimeTypes()
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Python27\lib\mimetypes.py", line 66, in __init__
init()
  File "D:\Python27\lib\mimetypes.py", line 358, in init
db.read_windows_registry()
  File "D:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
for subkeyname in enum_types(hkcr):
  File "D:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7 in position 8: ordinal
not in range(128)

i think this error was caused by the code in mimetypes.py's line 256

default_encoding = sys.getdefaultencoding() 

if change this line to:

default_encoding = sys.getfilesystemencoding()

such error will be resolved

--
components: Library (Lib)
messages: 215414
nosy: tanbro
priority: normal
severity: normal
status: open
title: mimetypes.MimeType UnicodeDecodeError
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com