Python Development on Windows

I’ve been rededicating myself to a Python project over the last couple of days and hence have been trying to get my Dell Windows 7 laptop set up for Python development again. It hasn’t been particularly easy. The things I’ve run into so far:

1. Python 2.6 happily runs on Windows 64bit whatever but not all 3rd party libraries are so forward thinking. Specifically, if you’ve got a project using PostgreSQL and SqlAlchemy, SqlAlchemy will complain about the Python driver psycopg2 on 64bit systems. There are other drivers out there but my solution was just to rollback my 64bit installation of Python and reinstall a 32bit version. That seems to be working fine though I haven’t gotten to the point of actually reading and writing data yet.

2. PYTHONPATH on Windows via the registry doesn’t seem to work, at least on my Windows 7 64bit installation. I have added the required registry keys per the documentation, rebooted 42 times and done the Guido van Rossum Purple Rain Remix dance with exactly zero results. For now, I’m just creating an environment variable the old fashioned way.

3. The real problem that led me to having to modify PYTHONPATH was that package imports just don’t seem to be working. I’m sure this is me being the Python equivalent of Charlie in Flowers For Algernon. I think in the past I must have had some magical setting or batch file that modified PYTHONPATH at startup or something but I wish my subpackage imports worked without having to resort to that.

On the plus side, my first TDD test passed first time up so I’ve got that going for me, which is nice. At least the code isn’t so stale that it doesn’t even function anymore.

Leave a Reply

Your email address will not be published. Required fields are marked *