On 5 ene, 13:33, Laszlo Nagy <[EMAIL PROTECTED]> wrote:
> Be aware with this. It is different when you do
>
> /usr/bin/python prog.py
>
> and
>
> ./prog.py
>
> In the first case, sys.argv[0] will be /usr/bin/python!
No, sys.argv[0] is always the running script, and sys.argv[1] the first
argument
Hi,
What about :
import os.path
print os.path.abspath(__file__)
hg a écrit :
> Hi,
>
> Is there an easy way for a script being executed (from anywhere) to know
> where is is ... something in os.path ?
>
> Thanks,
>
> hg
>
--
http://mail.python.org/mailman/listinfo/python-list
hg írta:
> hg wrote:
>
>
>> Hi,
>>
>> Is there an easy way for a script being executed (from anywhere) to know
>> where is is ... something in os.path ?
>>
>> Thanks,
>>
>> hg
>>
>
> oops: os.path.abspath(sys.argv[0])
>
Be aware with this. It is different when you do
/usr/bin/python pr
Laszlo Nagy wrote:
> hg i'rta:
>> Hi,
>>
>> Is there an easy way for a script being executed (from anywhere) to know
>> where is is ... something in os.path ?
>>
> __file__
>
> You can also use os.argv[0] but that is not the same...
>
> Laszlo
Thanks
--
http://mail.python.org/mailman/listin
hg i'rta:
> Hi,
>
> Is there an easy way for a script being executed (from anywhere) to know
> where is is ... something in os.path ?
>
__file__
You can also use os.argv[0] but that is not the same...
Laszlo
--
http://mail.python.org/mailman/listinfo/python-list
hg wrote:
> Hi,
>
> Is there an easy way for a script being executed (from anywhere) to know
> where is is ... something in os.path ?
>
> Thanks,
>
> hg
oops: os.path.abspath(sys.argv[0])
hg
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Is there an easy way for a script being executed (from anywhere) to know
where is is ... something in os.path ?
Thanks,
hg
--
http://mail.python.org/mailman/listinfo/python-list