Import error depending on where importing from

Jay O'Connor joconnor at cybermesa.com
Sat Aug 31 19:36:16 EDT 2002


In article <Xns927C877E79D25cliechtigmxnet at 62.2.16.82>, "Chris Liechti"
<cliechti at gmx.net> wrote:

> "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

That did the trick...thanks!

-- 
Jay O'Connor
joconnor at cybermesa.com
http://www.r4h.org/r4hsoftware



More information about the Python-list mailing list