2
I had the SAME problem, but I resolved it differently. In case anybody else has this problem in the future and the above solution does not work for you, try editing mimetypes.py from this:
with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr:
for subkeyname in enum_types(hkcr):
try:
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
# Only check file extensions
if not subkeyname.startswith("."):
continue
to this:
with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr:
for subkeyname in enum_types(hkcr):
try:
if '\0' in subkeyname: #ADD THIS LINE
print("Skipping bad key: %s" % subkeyname) #ADD THIS LINE
continue #ADD THIS LINE
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
# Only check file extensions
if not subkeyname.startswith("."):
continue
Like I said, this answer is just for anybody else running into this problem with no success in implementing any other answer.
0
Problem was with my Windows installation itself. There was some key that had invalid characters that mimetype.py was looping through as it looked for file associations.
Added the workaround to mimetype.py (+/- ln. 255):
**ln 252**
import re
**ln. 255**
pattern = re.compile('[\W{}\[\]_]+')
subkeyname = pattern.sub('',subkeyname)
Effectively, it stripes all none valid characters from subkeyname before it evaluates it as a registry key name.
Not the best, but it works. And probably is specific to this installation.
- [Answered ]-Django not response to Ajax call while doing a computing intensive task
- [Answered ]-Decode unicode to string in django template
- [Answered ]-When using Q objects in django queryset for OR condition error occured
- [Answered ]-Django: Form check if field has no error
- [Answered ]-Django 'OneToOneField' object has no attribute 'id'
Source:stackexchange.com