[Tutor] A few Questions
Michael Lange
klappnase at freenet.de
Sat Sep 4 23:55:56 CEST 2004
On Sat, 4 Sep 2004 12:39:24 +0100
Adam Cripps <kabads at gmail.com> wrote:
> On Sat, 4 Sep 2004 11:13:17 +0100, Alan Gauld
> <alan.gauld at blueyonder.co.uk> wrote:
> > > 1.What command makes the python programme print out the file it is
> > in?
> >
> > The sys.argv[0] value should be the name of the python script.
> > I don't think it provides the full path however.
> > And what happens if you use py2exe I have no idea.
>
> I'm pretty sure that it does show the whole path on Windows - not sure
> for *nix. I used this a few days ago and remembered that I didn't need
> to use [0].
>
> HTH
>
> Adam
>
On linux it shows the complete path, too, but in fact the path to the file that is called
from the command line, which might cause confusion if you use a symbolic link to launch your
program.
Regards
Michael
More information about the Tutor
mailing list