Need compile python code, source is in html and starts with parameters:
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
I have installed ActivePython for windows. 14 5351
mistral wrote:
Need compile python code, source is in html and starts with
parameters:
Excuse me?
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
Is the line break intended?
I have installed ActivePython for windows.
What exactly do you want?
Python code is always compiled (to byte code) before it's run.
Regards,
Bjrn
--
BOFH excuse #359:
YOU HAVE AN I/O ERROR -Incompetent Operator error
Bjoern Schliessmann писал(а):
mistral wrote:
Need compile python code, source is in html and starts with
parameters:
Excuse me?
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
Is the line break intended?
I have installed ActivePython for windows.
What exactly do you want?
Python code is always compiled (to byte code) before it's run.
Regards,
Björn
--
Just to comple python ode - it creates html page, nothing more, nothing
else.. Just generate one html page.
mistral
Bjoern Schliessmann писал(а):
mistral wrote:
Need compile python code, source is in html and starts with
parameters:
Excuse me?
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
Is the line break intended?
I have installed ActivePython for windows.
What exactly do you want?
Python code is always compiled (to byte code) before it's run.
Regards,
Björn
--
Just to comple python ode - it creates html page, nothing more, nothing
else.. Just generate one html page.
mistral
mistral wrote:
Just to comple python ode - it creates html page, nothing more, nothing
else.. Just generate one html page.
I *think* this is what you want:
python -O -m py_compile file.py
python file.pyo
See: http://docs.python.org/lib/module-pycompile.html
Regards,
Jordan
MonkeeSage писал(а):
mistral wrote:
Just to comple python ode - it creates html page, nothing more, nothing
else.. Just generate one html page.
I *think* this is what you want:
python -O -m py_compile file.py
python file.pyo
See: http://docs.python.org/lib/module-pycompile.html
Regards,
Jordan
----------
this not work for me, show compilation error. Is there simple way
compile pythone file? its absolutely unclear with command line. Just
show me exact command I need run(from python interactive shell?)
mistral wrote:
this not work for me, show compilation error. Is there simple way
compile pythone file? its absolutely unclear with command line. Just
show me exact command I need run(from python interactive shell?)
OK...
# cd to where the file.py is
$ cd /some/dir
# start python interactively, enable optimized compiling
$ python -O
....
# import your file.py -- if this doesn't work then
# your file has errors and will not compile --
# if it works then your file is now compiled --
# file.pyo should now exist with file.py
>>import file
# you can also do it explicitly --
# import the compiler
>>import py_compile py_compiler.compile('file.py')
If that still doesn't work, show us the error, or we can't help you
very easily.
Regards,
Jordan
MonkeeSage wrote:
>import py_compile py_compiler.compile('file.py')
^^^^^^^^^^^
Should be:
>>py_compile.compile('file.py')
MonkeeSage wrote:
mistral wrote:
this not work for me, show compilation error. Is there simple way
compile pythone file? its absolutely unclear with command line. Just
show me exact command I need run(from python interactive shell?)
OK...
# cd to where the file.py is
$ cd /some/dir
# start python interactively, enable optimized compiling
$ python -O
...
# import your file.py -- if this doesn't work then
# your file has errors and will not compile --
# if it works then your file is now compiled --
# file.pyo should now exist with file.py
>import file
# you can also do it explicitly --
# import the compiler
>import py_compile py_compiler.compile('file.py')
If that still doesn't work, show us the error, or we can't help you
very easily.
Regards,
Jordan
---
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?
On 23 Sep 2006 12:24:58 -0700, 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" "$@"
This is not a python script. It appears to be a Unix shell script that calls a
python script.
Maybe it would help if you told us exactly what you're trying to accomplish
and why you think you need to "compile python code".
-Carsten
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?
Hmmm... Are you talking about _RUNNING_ python scripts? Is that what
you mean by "compile" -- you mean execute? Is that what this broken
shell script means?
"exec" "python" "-O" "$0" "$@"
You don't need exec, the double quote on every word breaks it, and
passing $0 (which is the shell script itself) to python is sure to
break. Try this:
#!/bin/sh
python -O "$@"
Then:
$ run_python.sh file.py arg1 arg2 arg3
Regards,
Jordan
MonkeeSage писал(а):
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?
Hmmm... Are you talking about _RUNNING_ python scripts? Is that what
you mean by "compile" -- you mean execute? Is that what this broken
shell script means?
"exec" "python" "-O" "$0" "$@"
You don't need exec, the double quote on every word breaks it, and
passing $0 (which is the shell script itself) to python is sure to
break. Try this:
#!/bin/sh
python -O "$@"
Then:
$ run_python.sh file.py arg1 arg2 arg3
Regards,
Jordan
-------
the html page just encoded within that py script. To get it, i need run
this python file.
Since i can no work with this command line, i tried via Python IDE
interface: I run this IDE, select File Run specify file name, in
'Parameters' box type parameters:
exec python -O $0 $@
and run. I got some file in output - unknown file type, then I renamed
it and got something look like a page i need. Dont know is this right
way or not, but it provided some result.. (unlike useless command line
interface)
All this extremelly inconvenient however. This ActivePython wrote in my
Registry 243 registry entries..
mistral
mistral wrote:
<various_othersписал(а):
There seems to be a rather large communication gap. Consider asking
your question in a Russian-speaking Python-related forum, for example: http://zope.net.ru/
Regards,
John
>>>>"MonkeeSage" <Mo********@gmail.com(M) wrote:
>Mmistral 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?
>MHmmm... Are you talking about _RUNNING_ python scripts? Is that what Myou mean by "compile" -- you mean execute? Is that what this broken Mshell script means?
>M"exec" "python" "-O" "$0" "$@"
>MYou don't need exec, the double quote on every word breaks it, and Mpassing $0 (which is the shell script itself) to python is sure to Mbreak. 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 <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: pi**@vanoostrum.org
Piet van Oostrum писал(а):
>>>"MonkeeSage" <Mo********@gmail.com(M) wrote:
Mmistral 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?
MHmmm... Are you talking about _RUNNING_ python scripts? Is that what
Myou mean by "compile" -- you mean execute? Is that what this broken
Mshell script means?
M"exec" "python" "-O" "$0" "$@"
MYou don't need exec, the double quote on every word breaks it, and
Mpassing $0 (which is the shell script itself) to python is sure to
Mbreak. 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 <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: pi**@vanoostrum.org
-----------
anyway, this is a wrong and clumsy way writing of scripts, rather than
write clear and correct code comfortable to work.
mistral This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chris McKeever |
last post by:
I am trying to modify the Mailman Python code to stop mapping
MIME-types and use the extension of the attachment instead. I am
pretty much clueless as to what I need to do here, but I think I have...
|
by: beliavsky |
last post by:
How do you keep Python code properly indented as you modify it? I use
an Emacs-type editor that has a Python mode, so the initial indenting
is easy. If I later want to put a 'for' loop (or an 'if'...
|
by: nell |
last post by:
Hi all,
I've developed a testing application in python, and should supply it in
a way that no one (lets say they are regular users) will understand it
and edit it.
The application source is all...
|
by: Charles |
last post by:
Dear sirs,
I'm doing some investigations on the Python language.
I'd like to know if it is possible to compile Python code made for the web
(an online database for instance), and to run it using...
|
by: Bayazee |
last post by:
hi
can we hide a python code ?
if i want to write a commercial software can i hide my source code from
users access ?
we can conver it to pyc but this file can decompiled ... so ...!!
do you...
|
by: Nader Emami |
last post by:
L.S.,
I have to compile (install) locally Python 2.5, because I don't have
'root' permission. Besides I would use 'sqlite3' as a database for
TurboGears/Django. I have installed 'sqlite3'...
|
by: Mitko Haralanov |
last post by:
For various reason, what I need to do is be able to send some Python
code (mostly entire functions in the form of a string) to a remote
server (written in Python), have that server compile the code...
|
by: vijay |
last post by:
Hi
I have a python code performing some computation for me.I have a
html page which passes certain argumnets to a php page.This php page
needs to pass on the value to the Python class and get the...
|
by: John Nagle |
last post by:
koblas wrote:
PyPy was supposed to help, but that project has been dragging on
for half a decade now. Personally, I think the Shed Skin approach
is more promising. PyPy has too many different...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
header("Location:".$urlback);
Is this the right layout the...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
| |