Absolute imports?

Roy Smith roy at panix.com
Sat Jan 8 15:03:01 EST 2011


If I have an absolute path to a file (i.e. '/home/roy/foo.py'), is there 
a way to import that as a module WITHOUT modifying sys.path?  I'm using 
Python 2.6.

I've read PEP 328, and don't really understand how the absolute imports 
it's talking about are supposed to work.  Should I be using 
imp.load_source()?



More information about the Python-list mailing list