finding pathname from within a module?
alex at integretechpub.com
Thu Sep 13 21:24:53 CEST 2001
On Thu, 13 Sep 2001 brueckd at tbye.com wrote:
> > Is there a way to do something like <thecurrentmodule>.__path__?
> import imp, os
> path = imp.find_module('yourmodule')
> filename = os.path.join(os.path.split(path), 'datafilename')
Thanks- I didn't know about the imp module. This is what I'm using now:
I've verified this works within the module being defined- which is exactly
what I needed.
fileName = os.path.join(imp.find_module('mymodule'),'myfilename')
More information about the Python-list