script filename and autorun

Lexy Zhitenev zhitenev at cs.vsu.ru
Tue Mar 18 09:50:15 EST 2003


"Simon Dahlbacka" wrote in message news:3e77229a$1 at newsflash.abo.fi...
> Hi,
>
Hi, also.

>
> 1) how do I get the filename of the current script running? (I want to
> detect location at runtime)
As I have solved this problem, the result that works anyhow this script is
executed is

import sys, os
print os.path.abspath(sys.argv[0])

> 2) is it enough with just a key "python
> c:\whateverthepathistomyprogram\prog.py" in ...\Run or do I also need full
> path to python?

It is enough on WinNT, 2000 and XP, but it won't work on Win9x branch. You
will have to write full path to interpreter. Of course it has to be
installed.

Lexy






More information about the Python-list mailing list