I was having trouble compiling psycopg. It would link against the version of Python that was installed via RPM on my Mandrake 9.1 box, which was version 2.2.3. I knew I had to link against the latest version of Python that I had installed from source. At the recent PyGTA meeting I attended, I asked if anyone knew about compiling psycopg from source. No one volunteered an answer but the fellow sitting next to me was looking over my shoulder as I attempted various things. He noticed that I had not specified where the python executable was but had only specified the version. Once we figured out how to do that, psycopg compiled fine. The command line parameters follow.
Once we did this, it was a simple matter of make and then make install to install psycopg. However, there was still no joy because this time, as soon as I tried to make a connection via SQLObject to PostgreSQL, Python threw an exception. See below:
>>> from SQLObject import *
>>> conn = PostgresConnection(host='localhost', db='doedb',user='cilkay')
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 547, in __init__
ImportError: /usr/local/lib/python2.3/site-packages/psycopgmodule.so: undefined symbol: PQresultErrorField
I suspected this still had something to do with library paths so I decided to try this on another machine with later versions of PostgreSQL and Python. I had been wanting to try Gentoo for some time so I decided to install it on one of the machines in the office. More on that next time...