Hello All

I want to import a module I wrote to use it in a script. But, it is not in the same directory as the script I want to import it into. So my solution is to put the following piece of code in the script:

import os
os.chdir(<the direcotry where the module is kept>)
import <the module>

This generates an error: 'ImportError: no module named <the module>'

If I do the exact same code in interactive mode, using ipython it works fine, but when I try it in a script I get the error. I've even used os.listdir() after changing the directory to confirm that the module is in the cwd (and it is).

Where am I going wrong?
(I use windows XP, and enthought edition python2.4)

Thanks
Izak


Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to