[Pythonmac-SIG] Re: Running the pyPgSQL postgresql driver?

Russell E. Owen rowen at cesmail.net
Mon Dec 15 12:57:51 EST 2003


In article <a06002000bbff069f0bf2@[192.168.1.100]>,
 "Marlon A. Griffith" <marlong at rogers.com> wrote:

> I have managed to install pyPgSQL on my mac:
> - X.2.8
> - postgresql 7.3
> - MacPython 2.3, the July 30th 2003 release...
> through the instructions at 
> http://pypgsql.sourceforge.net/README.html and the modifications 
> noted in an earlier post. I was running the testcases when I got this 
> message:
> """
> [Kalyxsis-Sways-Computer:~] postgres% python 
> /Volumes/scratch/jython/pypgsql/test/PgSQLTestCases.py
> Traceback (most recent call last):
>    File "/Volumes/scratch/jython/pypgsql/test/PgSQLTestCases.py", line 
> 89, in ?    from pyPgSQL import PgSQL
> ImportError: No module named pyPgSQL
> """
> 
> I tried to import the module using Apple's python and MacPython. 
> MacPython worked and Apple's didn't. I got this error in Apple's 
> python:..

The basic problems (I think) is that when you type "python setup.py" at 
the command line, you are telling setup.py WHICH python gets the module. 
If you want to install on more than one python, follow the installation 
instructions using each version of Python in turn.

But do you really want two versions of python? MacPython 2.3 includes a 
command-line python installed in /usr/local/bin (this is a link to a 
file in the framework python 2.3). If you used that, then you could 
install packages once and have them available both from MacPython and 
command line python!

One way to get python 2.3 as your command-line python is to put 
/usr/local/bin before /usr/bin in your PATH. One way to do this is 
create or edit a text file ~/.cshrc (preferably with unix line endings) 
to include:
setenv PATH "/usr/local/bin:/Library/Tcl/bin:"$PATH

I'm not sure this is the full answer. I somewhat suspect you already 
know what I wrote if you managed to install the package in MacPython 2.3 
framework instead of Apple's built in python. In any case, I *hope* this 
helps.

-- Russell

P.S. if you plan to do any GUI programming and want to set your 
PYTHONPATH, you'll want to set it in ./MacOSX/environment.plist rather 
than in .cshrc. One set of instructions is my page 
<http://www.astro.washington.edu/owen/AquaEnvVar.html>. I hope the info 
is also in the MacPython documentation but I haven't looked recently.




More information about the Pythonmac-SIG mailing list