find a .py path

Gabriel Genellina gagsl-py at yahoo.com.ar
Sun Jan 7 14:07:56 EST 2007


On 5 ene, 13:33, Laszlo Nagy <gand... at designaproduct.biz> 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 after the script, and so on. It doesn't matter if you call
python implicitely, or with other options. Try this:
/usr/bin/python -i -u -O prog.py

-- 
Gabriel Genellina




More information about the Python-list mailing list