Confusing, desparate MySQLdb problems...

stopchuckingstuff stopchuckingstuff at me.com
Sun Jan 17 13:04:41 CET 2010


On Jan 17, 4:01 am, Ned Deily <n... at acm.org> wrote:
> In article
> <5bc2641f-44fc-4324-b299-400ccbc79... at p8g2000yqb.googlegroups.com>, stopchuckingstuff <stopchuckingst... at me.com> 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:
>
> http://code.google.com/p/modwsgi/http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSXhttp://code.google.com/p/modwsgi/wiki/WhereToGetHelp
>
> Good luck.
>
> --
>  Ned Deily,
>  n... at acm.org

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/
2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg)
is present in both sys.paths - as i said, both sys.paths are
identical.

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?

Thanks
Sam



More information about the Python-list mailing list