Find the location of a loaded module

Aaron Scott aaron.hildebrandt at gmail.com
Fri Feb 20 16:16:26 EST 2009


And more madness...

Executed from inside 'act1', which contains the directory / module
'story':


	directory = os.path.dirname(__file__)
	req.write(str(directory))
	story = apache.import_module('story', path=[directory])


Results:


  File "/home/www/---/docs/act1/play.py", line 24, in Rebuild
    storylab = apache.import_module('story', path=[directory])

  File "/usr/local/python2.5.2/lib/python2.5/site-packages/mod_python/
importer.py", line 304, in import_module
    return __import__(module_name, {}, {}, ['*'])

ImportError: No module named story


Awesome. I'm going to go stick my head through a wall.



More information about the Python-list mailing list