Confusing, desparate MySQLdb problems...

Ned Deily nad at acm.org
Sat Jan 16 20:54:01 EST 2010


In article 
<8647768b-944c-4025-8389-768a9cae587c at u41g2000yqe.googlegroups.com>,
 stopchuckingstuff <stopchuckingstuff at me.com> wrote:
> On Jan 17, 12:14 am, Ned Deily <nad at acm.org> wrote:
> > In article
> > <0ba7faf8-f816-4100-ba5b-b138d3008b29 at c3g2000yqd.googlegroups.com>,
> >  stopchuckingstuff <stopchuckingstuff at me.com> wrote:
> > > I have installed MySQLdb on Mac OSX 10.6.2, and have it working when
> > > running on my system in IDLE and in terminal, however encounter
> > > continual problems when running it through Apache.
> > > When trying to import the module, it gives me this error:
> > > <type 'exceptions.ImportError'>: /Library/WebServer/.python-eggs/
> > > MySQL_python-1.2.3c1-py2.6-macosx-10.3-fat.egg-tmp/_mysql.so: no
> > > appropriate 64-bit architecture (see "man python" for running in 32-
> > > bit mode) [...]
> > Most likely possibility: you've installed another Python on 10.6,
> > probably from python.org, which only runs in 32-bit mode while Apache is
> > using the Apple-supplied Python 2.6.1 which, by default, runs in 64-bit
> > mode. [...]
> Thanks very much - I think this must be the problem (which python
> produces some long path to Python 2.6). Ideally, I'd like to change
> Apache's path to python as I had such problems installing MySQLdb -
> would you have any idea how to do it?
[...]
> Sorry for the repeat posts, but would it be to do with the first line
> of all my scripts - #!/usr/bin/env python?

/usr/bin/env python will cause the first command named python in the 
process's execution path ($PATH) to be used.  Apache is probably not 
running under your user name and does not have the PATH modification in 
your .bash_profile to stick that long path to the python.org Python 2.6 
bin directory at the front of $PATH.   Rather than changing Apache's 
startup, the easier solution would probably be to modify your scripts to 
point at the desired python.  By default, the python.org installers put 
a link to that python in /usr/local/bin so it may be easier to use a 
shebang line like:

#!/usr/local/bin/python 
or
#!/usr/local/bin/python2.6

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list