Confusing, desparate MySQLdb problems...

Ned Deily nad at acm.org
Sun Jan 17 05:01:40 CET 2010


In article 
<5bc2641f-44fc-4324-b299-400ccbc79616 at p8g2000yqb.googlegroups.com>,
 stopchuckingstuff <stopchuckingstuff 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/InstallationOnMacOSX 
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp

Good luck.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list