bug or feature? traceback with python -x off by one line

Dale Nagata dnagata at creo.com
Sun Apr 11 19:04:02 EDT 1999


Blake Winton wrote:
> 
> >       @python -x %~f0 %* & goto :EOF
> 
> Hey, that's pretty cool looking...  But I have to wonder, why don't you
> just type "filename.py"?  The associations are set up correctly by
> default if I remember correctly, so if you have python installed on the
> machine, you don't need the trick.  (Say, does that work on Win95/98 as
> well?  There it could be very handy for some stuff we're doing at
> work...)
> 

I don't just type filename.py because I can't be certain that
the machine the script will run on has Python installed in the
normal way with file type associations defined etc, but I can 
reasonably expect that it will have a native NT CMD.EXE command 
interpreter that supports the above cool-looking syntax, and a 
minimalistic Python run time environment.

The above trick doesn't work with the 4NT command interpreter,
and I am almost certain it won't with Win95/98's either (and it 
won't work on NT's built-in CMD.EXE if command extensions are 
disabled).

And besides, redirecting I/O is known not to work properly if
you try to use

	filename.py >filename.out

instead of

	python filename.py >filename.out

but it does work if the cool syntax is used.


--
Dale Nagata         |  tel : +1 604.451.2700 ext. 2254 (UTC-0800)
Software Developer  |  fax : +1 604.437.9891 
Creo Products Inc.  |  pgr : +1 604.691.8279
Burnaby BC Canada   |  http://www.creo.com/




More information about the Python-list mailing list