Confusing, desparate MySQLdb problems...

stopchuckingstuff stopchuckingstuff at
Sun Jan 17 13:04:41 CET 2010

On Jan 17, 4:01 am, Ned Deily <n... at> wrote:
> In article
> <5bc2641f-44fc-4324-b299-400ccbc79... at>, stopchuckingstuff <stopchuckingst... at> wrote:
> [...]
> > 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?!
> Sounds like setuptools is not being found on sys.path.  And, judging
> from your earlier post, it appears that sys.path when running under
> Apache includes /Library/WebServer/.python-eggs.  Perhaps you need to
> ensure setuptools is installed there.  That wouldn't normally be on the
> python's sys.path when running from the terminal.
> But I realized after my last response that I should have asked how you
> were using Python with Apache: presumably with mod_wsgi or, possibly,
> mod_python.  In either case, the configurations are more complex and
> something I have little experience with so I should probably point you
> elsewhere.  For mod_wsgi, Graham Dumpleton offers exemplary thorough
> documentation here:
> Good luck.
> --
>  Ned Deily,
>  n... at

I'm not using either mod_wsgi or mod_python, I just edited httpd.conf.

You're right about setuptools - imports in terminal, not in cgi.
however, the path to it (/Library/Frameworks/Python.framework/Versions/
is present in both sys.paths - as i said, both sys.paths are

And from printing the sys.paths, /Library/WebServer/.python-eggs
doesn't appear, I think it just uses it as a temporary folder to unzip
the python eggs into.

What I don't understand is if the path is there, why doesn't it find
the module?


More information about the Python-list mailing list