>> How can I find where exactly the current python script is running?
 >
> Doesnt __file__ attribute of each module contain the full filepath of
> the module?
 >

Yes indeed! But the path to the module will not be the same as the path to 
the script if you are currently in an imported module. Consider this:

my_script.py:
---------------------------
import my_module

---------------------------

my_module.py:
---------------------------
print __file__

---------------------------

Running "python test.py" now prints /path/to/my_module.py, not 
/path/to/my_script.py.

Cheers!
/Joel Hedlund
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to