-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Description
We just encounter the issue on Windows that Python 2.7 threw a TypeError on mimetypes initialization.
C:\Python27>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
C:\Python27>python -c "import mimetypes; mimetypes.init()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\mimetypes.py", line 351, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 254, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: must be string without null bytes or None, not str
The suggested workaround is to catch the TypeError when the Shotgun API first uses mimetypes
import mimetypes # used for attachment upload
try:
mimetypes.add_type('video/webm','.webm') # try adding to test for unicode error
except (UnicodeDecodeError, TypeError):
# Ticket #25579 python bug on windows with unicode
# Ticket #23371 mimetypes initialization fails on Windows because of TypeError (http://bugs.python.org/issue23371)
# Use patched version of mimetypes
from .lib import mimetypes as mimetypesSee also: mimetypes initialization fails on Windows because of TypeError (http://bugs.python.org/issue23371)
Metadata
Metadata
Assignees
Labels
No labels