Ivan Zuzak wrote:
> Joel Hedlund wrote:
>
> > 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:
>
> I thought that was the point - to get the full path of the running
> script? I see you use the term
Joel Hedlund wrote:
> 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:
I thought that was the point - to get the full path of the running
script? I see you use the terms "script" and "module" in dif
> Running "python test.py" now prints /path/to/my_module.py, not
> /path/to/my_script.py.
That should have been "python my_script.py". Sorry for the slip-up.
Cheers!
/Joel
--
http://mail.python.org/mailman/listinfo/python-list
>> 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. Cons
gmax2006 wrote:
> Hi,
>
> I use RedHat linux.
>
> How can I find where exactly the current python script is running?
Hi,
Doesnt __file__ attribute of each module contain the full filepath of
the module?
So, try this:
filepath = __file__
print filepath
Works for me :)
Cheers,
i. zuzak
--
htt
>> How can I find where exactly the current python script is running?
>> ...
>> That means sys.argv[0] doesn't always contain the full path of
>> running script.
> sys.path[0] is the script directory, combined with sys.argv[0] you can
> find the full path to th
Hello Max,
> How can I find where exactly the current python script is running?
> ...
> That means sys.argv[0] doesn't always contain the full path of
> running script.
sys.path[0] is the script directory, combined with sys.argv[0] you can
find the full path to the script.
(Note
That means sys.argv[0] doesn't always contain the full path of
running script.
Any help would be appreciated,
Max
--
http://mail.python.org/mailman/listinfo/python-list