mwh at python.net
Tue Oct 5 15:29:00 CEST 2004
Andreas Lobinger <andreas.lobinger at netsurf.de> writes:
> i want to put a short script and additional data together in
> an shellexecutable, like this
> #!/usr/bin/env python
> import sys
> print sys.argv
> other data following, strictly not in python syntax...
> 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
Well, you'll get into real trouble around the 2 gig mark on most
machines, though I guess memory consumption will hurt you first.
> and how do i escape the tripple-" ?
Another option, instead of having 'python' in your hash-bang line
would be to have a program that preprocessed the file before handing
it to Python.
If you don't use emacs, you're a pathetic, mewling, masochistic
weakling and I can't be bothered to convert you. -- Ron Echeverri
More information about the Python-list