Confusing, desparate MySQLdb problems...

stopchuckingstuff stopchuckingstuff at me.com
Sun Jan 17 03:55:19 CET 2010


On Jan 17, 1:54 am, Ned Deily <n... at acm.org> wrote:
> In article
> <8647768b-944c-4025-8389-768a9cae5... at u41g2000yqe.googlegroups.com>,
>
>
>
>
>
>  stopchuckingstuff <stopchuckingst... at me.com> wrote:
> > On Jan 17, 12:14 am, Ned Deily <n... at acm.org> wrote:
> > > In article
> > > <0ba7faf8-f816-4100-ba5b-b138d3008... at c3g2000yqd.googlegroups.com>,
> > >  stopchuckingstuff <stopchuckingst... 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,
>  n... at acm.org

This just gets even more confusing!

I used a shebang line:

#!/Library/Frameworks/Python.framework/Versions/2.6/bin/python

which i got from which python in terminal, and now i get this error
when trying to import MySQLdb:

<type 'exceptions.ImportError'>: No module named pkg_resources

How!? I don't get that error when using that same version of python in
IDLE...

What's going on?!

Many thanks for your ongoing assistance!
Sam



More information about the Python-list mailing list