Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63013
| References | <6c137d0d-a20c-48c4-9115-f8d2d8134433@googlegroups.com> |
|---|---|
| Date | 2014-01-03 11:26 +1100 |
| Subject | Re: Setuptools - cannot install |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4815.1388708820.18130.python-list@python.org> (permalink) |
On Fri, Jan 3, 2014 at 9:26 AM, <tim.hamza@gmail.com> wrote:
> File "C:\Python\lib\mimetypes.py", line 255, in read_windows_registry
> with _winreg.OpenKey(hkcr, subkeyname) as subkey:
> TypeError: OpenKey() argument 2 must be str without null characters or None, not str
Interestingly, I pulled up that file on my 3.3.0 (Windows) and that
line is different. May be related to this issue, which was cited in
the commit summary that effected the change:
http://bugs.python.org/issue15207
In 3.3.0, it looks for HKEY_CLASSES_ROOT plus subkey
r'MIME\Database\Content Type', but in 3.3.3 it's iterating over all
the subkeys in HKEY_CLASSES_ROOT. (Note that _winreg is simply the
winreg module or None if it couldn't be imported.) I wonder is it
possible you have a null character in a key?? It's worth a try.
>>> import winreg
>>> hkcr=winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, '')
>>> for i in range(999999):
key=winreg.EnumKey(hkcr,i)
if '\0' in key: print(repr(key))
If that throws a "No more data available" error without printing any
keys, then this isn't your problem.
Alternatively, you could hack C:\Python\lib\mimetypes.py to print out
subkeyname before attempting to open it. That would at least tell you
what the offending key is. My suspicion at the moment is that you may
have a corrupted registry, or else there's something that's possible
that the winreg module doesn't expect.
BTW, thanks for the first-line summary of version numbers. Much
appreciated! So many people don't give that.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Setuptools - cannot install tim.hamza@gmail.com - 2014-01-02 14:26 -0800 Re: Setuptools - cannot install Chris Angelico <rosuav@gmail.com> - 2014-01-03 11:26 +1100
csiph-web