Have been building a site using Turbogears 2.0 of late (which is awesome), and decided it was time to start setting up my staging and production environments.  Thus far I have just been developing locally with sqlite, but in production I want to use postgresql… so tried to install psycopg2 via distutils and was met with the following error

NameError: global name 'w' is not defined

Eek!

Finding the solution seemed to take me far too many googles… so thought I’d pop up here so I have no excuse for forgetting next time I do exactly the same

For me the solution was to add the following to my path, since I appears that pscopg2 requires postgres to be installed before it can compile (My version of postgres is installed via macports)

export PATH=/Library/PostgreSQL/8.3/bin:$PATH

Once the postgres bin folder was in the path pscopg2 compiled without any troubles. Win