Importing MySQLdb/Changing Paths at run-time

Mundeep mund33p at yahoo.com.au
Fri Sep 28 08:30:55 EDT 2001


Hi, I've been introduced to python to use for my final year thesis and
i've been having some trouble trying to use the MySQLdb module.
Because i am running it on my university's machines i have had to
install the module into my home directory instead of where python
normally puts its modules (using the command: python setup.py install
--home=<dir>), and i have the problem that when i execute a script
through apache (i put it in my cgi-bin directoy) it doesn't find the
MySQLdb module to import. I have tried running various commands such
as:
sys.path.insert(0, "/import/bizet/4/mundeepr/python/lib/python")
& 
os.environ["PATH"]="/usr/sbin:/usr/bin:/import/bizet/4/mundeepr/python/lib/python"

to try to get python to import the module but they dont seem to work.
Is there any other way to adjust the path in a python script so it
will import the module?

(/import/bizet/4/mundeepr/python/ is the directory i installed MySQLdb
to it created the /lib & /lib/python folders where it stores all its
files).

If i have been a bit vauge or there is soemthing you dont understand
and you think you might be able to help please send me a mail.

Thanx In Advance For Any Help

Cheers,
Mundeep



More information about the Python-list mailing list