From: bwinton at tor.dhs.org (Blake Winton)
Date: Sun, 11 Apr 1999 18:35:53 GMT
Subject: bug or feature? traceback with python -x off by one line
References: <3710DF00.DF5@creo.com>
Message-ID: <slrn7h1ndv.i1i.bwinton@tor.dhs.org>
Content-Length: 1419
X-UID: 1207                                                  

On Sun, 11 Apr 1999 10:42:24 -0700, Dale Nagata <dnagata at creo.com> wrote:
>I package a lot of Python scripts as ready-to-run Windows NT batch
>files by prepending the line
>	@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...)

>which means "without echoing to the console window, run Python with the

This got me started thinking about the "Hello Polyglot" program I saw a
while ago, and I wondered just what that line would do if interpreted as
a Perl program (because of the @)...  The answer is:

syntax error at temp2 line 1, near "@python -x "
Warning: Use of "-x" without parens is ambiguous at temp2 line 1.
Bareword found where operator expected at temp2 line 1, near "%~f0"
        (Missing operator before f0?)
Execution of temp2 aborted due to compilation errors.

>Any ideas on the best way to resolve this?  How, from within a script,
>can I detect that the -x option is in effect? Or do I have to go hack
>the interpreter source?

I think you'ld have to hack the source, since the traceback line numbers
are set in there, no matter what you do.

Later,
Blake.





