Archive

Posts Tagged ‘python’

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.

Making It Easy To Learn Programming

January 16th, 2010 Niklaus Wirth's Ghost 2 comments

Glenn Reynolds talks about a shortage of geeks and one of his readers comments that a key contribution to this is when computers stopped shipping with BASIC. Glenn makes the plea to computer makers to include BASIC on the computers as a public service. Of course, Macs already ship with both Python and Ruby, surely superior languages to BASIC and excellent learning languages as well.

On a Mac, all you have to do is fire up a terminal (Apple Key + Space Bar and then type “Terminal”), type “python” in the new terminal and you have a place to start learning programming. Work through the Python tutorial and you’re well on the way to becoming a novice Python programmer.

Of course, on a Windows machine you’re going to have to do a little more work because, well, it is Windows after all.

Categories: Programming Tags: ,