Need compile python code
polychrom at softhome.net
Mon Sep 25 23:56:04 CEST 2006
Piet van Oostrum писал(а):
> >>>>> "MonkeeSage" <MonkeeSage at gmail.com> (M) wrote:
> >M> mistral wrote:
> >>> No, something is wrong there. what I need is just compile one python
> >>> file which will generate html page, with parameters:
> >>> "exec" "python" "-O" "$0" "$@"
> >>> just need simple way do this(script is correct), i will not set any
> >>> patches anywhere, can i do this wrom normal GUI?
> >M> Hmmm... Are you talking about _RUNNING_ python scripts? Is that what
> >M> you mean by "compile" -- you mean execute? Is that what this broken
> >M> shell script means?
> >M> "exec" "python" "-O" "$0" "$@"
> >M> You don't need exec, the double quote on every word breaks it, and
> >M> passing $0 (which is the shell script itself) to python is sure to
> >M> break. Try this:
> I guess this is a trick to use a python script as a shell script that
> executes itself. In other words it is both a shell script and a python
> script and when executed as a shell script then it passes itself to the
> python interpreter. When executed as a python script the first line is a
> comment and the second line is a string (equal to 'execpython-O$0$@'), so
> both are skipped.
> You can't use that in windows, or maybe there is an equivalent trick.
> Piet van Oostrum <piet at cs.uu.nl>
> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
> Private email: piet at vanoostrum.org
anyway, this is a wrong and clumsy way writing of scripts, rather than
write clear and correct code comfortable to work.
More information about the Python-list