I have been developing under Python/Snowleopard happily for the part 6 months. I just upgraded Python to 2.6.5 and a whole bunch of libraries, including psycopg2 and Turbogears. I can start up tg-admin and run some queries with no problems. Similarly, I can run my web site from the command line with no problems.
However, if I try to start my application under Aptana Studio, I get the following exception while trying to import psychopg2:
('dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID\n Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so\n Expected in: flat namespace\n in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so',)
This occurs after running the following code: try: import psycopg2 as psycopg except ImportError as ex: print "import failed :-( xxxxxxxx = " print ex.args
I have confirmed that the same version of python is being run as follows: import sys print "python version: ", sys.version_info
Does anyone have any ideas? I've seem some references alluding to this being a 64-bit issue. - daveAnswer1:
Problem solved (to a point). I was running 64 bit python from Aptana Studio and 32 bit python on the command line. By forcing Aptana to use 32 bit python, the libraries work again and all is happy.