Self-awareness of imported modules? Do they know where they live?
modelnine at bit-bukket.org
Thu Dec 15 08:52:02 CET 2005
Martin M. wrote:
> So how can I do this? In AppleScript I would try something like "path
> to me", but this does not work for imported scripts in AppleScript, as
> you then only get the path to the main script. But can this be done in
> Python? Can modules know where they are currently located, where they
> live? Can they be self-aware?
Yes, they can be:
modelnine at phoenix ~ $ cat test.py
modelnine at phoenix ~ $ python test.py
modelnine at phoenix ~ $
More information about the Python-list