finding pathname from within a module?
Alex Rice
alex at integretechpub.com
Thu Sep 13 13:05:42 EDT 2001
More information about the Python-list mailing list
Thu Sep 13 13:05:42 EDT 2001
- Previous message (by thread): finding pathname from within a module?
- Next message (by thread): finding pathname from within a module?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I know there must be a more pythonic way than this. My module needs to
be able to read a datafile in the same directory the module is defined.
What I came up with for creating the filename is this:
pathEls = string.split(__file__, os.sep)[:-1]
pathEls.append('my.data')
fileName = string.join(pathEls, os.sep)
Is there a way to do something like <thecurrentmodule>.__path__?
Alex
- Previous message (by thread): finding pathname from within a module?
- Next message (by thread): finding pathname from within a module?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list