stop executing

Andreas Lobinger andreas.lobinger at netsurf.de
Tue Oct 5 04:58:15 EDT 2004


Aloha,

i want to put a short script and additional data together in
an shellexecutable, like this

--begin-file--
#!/usr/bin/env python
import sys
print sys.argv
sys.exit()

other data following, strictly not in python syntax...
--end-file--

I would expect the interpreter to stop after the sys.exit, but of
course the parser tries to read on.
lobingera at scylla: b.py
   File "b.py", line 7
     other data
              ^
SyntaxError: invalid syntax

I have now a somehow working solution by putting the data in a
multiline string, but that raises the subquestion:
How much data can be put in a multiline string and how do i
escape the tripple-" ?

Hoping for an answer and wishing a happy day
		LOBI



More information about the Python-list mailing list