#!/usr/bin/python
# module show_my_path
# ...
import os
print 'os.path.abspath(__file__):', os.path.abspath(__file__)
# ...
# end of module
[EMAIL PROTECTED] class]$ python
>>> import show_my_path
os.path.abspath(__file__): /misc/proc/py/test/class/show_my_path.py
>>>
[EMAIL PROTECTED] class]$ p
Papalagi Pakeha wrote:
> I guess I could do it with a little help of os.path.realpath() for all
> those cases where absolute or relative path was used. But how should I
> approach it when it's invoked as plain 'blah.py' because its directory
> name is in $PATH?
Use the value of __file__ rather t