# I must be missing something obvious in installing Python 3.4.2...

Tim Golden mail at timgolden.me.uk
Mon Jan 12 21:52:08 CET 2015

```
On 12/01/2015 18:02, Andrew Koenig wrote:
> Downloaded and installed 64-bit Python 3.4 and pywin32-219. Both installed smoothly on my 64-bit Win7 machine. I added C:\Python34 to the search path.
>
> If I launch a Windows command window and run
>
>          python -m ensurepip
>
> I get the following:
>
> Ignoring indexes: https://pypi.python.org/simple/
> Cleaning up...
> Exception:
> Traceback (most recent call last):
>    File "C:\Users\ark\AppData\Local\Temp\tmpe3ckts9f\pip-1.5.6-py2.py3-none-any.w
> hl\pip\basecommand.py", line 122, in main
>      status = self.run(options, args)
>    File "C:\Users\ark\AppData\Local\Temp\tmpe3ckts9f\pip-1.5.6-py2.py3-none-any.w
> hl\pip\commands\install.py", line 278, in run
>      requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
> e=self.bundle)
>    File "C:\Users\ark\AppData\Local\Temp\tmpe3ckts9f\pip-1.5.6-py2.py3-none-any.w
> hl\pip\req.py", line 1177, in prepare_files
>    File "C:\Users\ark\AppData\Local\Temp\tmpe3ckts9f\pip-1.5.6-py2.py3-none-any.w
> hl\pip\index.py", line 209, in find_requirement
>      file_locations, url_locations = self._sort_locations(locations)
>    File "C:\Users\ark\AppData\Local\Temp\tmpe3ckts9f\pip-1.5.6-py2.py3-none-any.w
> hl\pip\index.py", line 128, in _sort_locations
>      sort_path(os.path.join(path, item))
>    File "C:\Users\ark\AppData\Local\Temp\tmpe3ckts9f\pip-1.5.6-py2.py3-none-any.w
> hl\pip\index.py", line 109, in sort_path
>      if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
>    File "C:\Python34\lib\mimetypes.py", line 287, in guess_type
>      init()
>    File "C:\Python34\lib\mimetypes.py", line 348, in init
>    File "C:\Python34\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

Ouch! That looks like another variation on a bug of which we've fixed at
least two variations to do with reading mimetypes from the Windows
registry. Can you see what the following code produces, please:

<code>
import winreg as _winreg

hkcr = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, "")

with open("classes.txt", "w") as f:
i = 0
while True:
try:
ctype = _winreg.EnumKey(hkcr, i)
except EnvironmentError:
break
else:
f.write("%s -> %r\n" % (type(ctype), ctype))

i += 1

</code>

TJG

```