Category Archives: Python

Python ‘pip’ and Windows registry corruption


In my recent post about setting up a 64 bit Windows Django development environment, I described an initial problem with Virtualenv which then led me through a whole series of problems and fixes and finally to what I thought was a working 64 bit Python development environment. However, I recently realised that the original underlying issue still remained, such that any attempt to install a new package using pip would result in failure due to that same error message.

For example, when I tried to install Beautiful Soup via pip, I got the following error:

C:\> pip install beautifulsoup4
Downloading/unpacking beautifulsoup4
Cleaning up...
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\", line 122, in main
status =, args)
File "C:\Python27\lib\site-packages\pip\commands\", line 278, in run

requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundl
File "C:\Python27\lib\site-packages\pip\", line 1229, in prepare_files
File "C:\Python27\lib\site-packages\pip\", line 292, in run_egg_info
logger.notify('Running (path:%s) egg_info for package %s' % (self.s
File "C:\Python27\lib\site-packages\pip\", line 265, in setup_py
import setuptools
File "C:\Python27\lib\site-packages\setuptools\", line 12, in
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\", line 7, in
from setuptools.dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\", line 15, in
from setuptools.compat import numeric_types, basestring
File "C:\Python27\lib\site-packages\setuptools\", line 19, in
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\", line 27, in
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\", line 208, in SimpleHTTPRequestHand
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\", line 361, in init
File "C:\Python27\lib\", line 263, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: must be string without null bytes or None, not str

Continue reading Python ‘pip’ and Windows registry corruption

Create a Django development environment on 64-bit Windows for Heroku deployment

Getting Started with Django on Heroku

This weekend I tried to follow Heroku’s Getting Started with Django article. Unfortunately for me, this article is clearly aimed at developers working in a “unix-style environment”, and I develop with a 64-bit Windows machine both at work and at home. Given that we are working with a Python-based framework, I foolishly assumed that it would be trivial to translate these instructions to Windows. How wrong I was.

This article summarises all the issues I encountered and how I eventually worked around them. I found most of the individual answers I needed via Google, but I couldn’t find a single resource that explains this whole process. I hope it saves you some time. The specific error-messages and console output were generated with 64-bit Windows 8.1, but I expect things to be basically the same with 64-bit Windows 7.

Continue reading Create a Django development environment on 64-bit Windows for Heroku deployment