Import error depending on where importing from
Chris Liechti
cliechti at gmx.net
Sun Sep 1 07:19:22 EDT 2002
"Jay O'Connor" <joconnor at cybermesa.com> wrote in
news:20020831.231529.1350573793.13153 at cybermesa.com:
> For certain reasons, I had to put the MySQLdb files in my own directory
> (called 'lib'). Now, when I'm in the lib directory I can import MySQLdb
> and use it fine. However, when I'm one directory up, and I try to do
> "from lib import MySQLdb" I get
> ImportError: _mysql: init failed
you need to make sure that the module is in a directory that is in
"sys.path". you can add you "lib" with
"sys.path.append(os.path.abspath('lib'))" or whatever is appropriate for
you.
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list