#!/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
Hi,
I have a project (a django project actually) that has a structure
something like:
/path/prj/settings.py
/path/prj/scripts/blah.py
/path/prj/...
In order to run blah.py I need to set $PYTHONPATH to /path/prj because
it does "import settings". That's all good. I would however like to
autodetect