I use a makefile to create distribution tarballs of freestanding Python
programs and their documentation. I cannot seem to find the right
command line option to just generate a pyc/pyo file from the program
and then exit. If I use 'python -OOOO -c"import myprog"' it creates
the pyo file, but myprog starts up and keeps running.
IOW, I need a batch method for generating compiled python. I know it
exists, but I can't find it for some reason ...
TIA,
--
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/ 8 4194
Tim Daneliuk wrote: I use a makefile to create distribution tarballs of freestanding Python programs and their documentation. I cannot seem to find the right command line option to just generate a pyc/pyo file from the program and then exit. If I use 'python -OOOO -c"import myprog"' it creates the pyo file, but myprog starts up and keeps running.
IOW, I need a batch method for generating compiled python. I know it exists, but I can't find it for some reason ...
TIA,
Hi,
take a look at http://docs.python.org/lib/module-compileall.html
HtH, Roland
Roland Heiber wrote: Tim Daneliuk wrote:
I use a makefile to create distribution tarballs of freestanding Python programs and their documentation. I cannot seem to find the right command line option to just generate a pyc/pyo file from the program and then exit. If I use 'python -OOOO -c"import myprog"' it creates the pyo file, but myprog starts up and keeps running.
IOW, I need a batch method for generating compiled python. I know it exists, but I can't find it for some reason ...
TIA,
Hi,
take a look at http://docs.python.org/lib/module-compileall.html
HtH, Roland
It does - thanks. One more question: Are pyc and pyo file portable
across operating systems? I suspect not since I generated a pyo
on a FreeBSD machine that will not run on a Win32 machine. I was
under the impression that "compiled" meant optimized byte code that
was portable across implementations, but it looks to not be the case...
--
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/
Tim Daneliuk wrote: It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" meant optimized byte code that was portable across implementations, but it looks to not be the case...
Hi,
..pyc's should be, cause it's standard python-bytecode, if you use
massive optimizations it depends not on the os but on the underlying
cpu/architecture ...
So long, Roland
Roland Heiber wrote: Tim Daneliuk wrote:
It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" meant optimized byte code that was portable across implementations, but it looks to not be the case...
Hi,
..pyc's should be, cause it's standard python-bytecode, if you use massive optimizations it depends not on the os but on the underlying cpu/architecture ...
So long, Roland
You probably tried to use a bytecode file from *one* version of Python
with an interpreter of another version. Python actually checks the first
four bytes of the .pyc file for a compatible "magic number" before
accepting the file for execution.
regards
Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.python.org/pycon/2005/
Steve Holden http://www.holdenweb.com/
Steve Holden wrote: Roland Heiber wrote:
Tim Daneliuk wrote:
It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" meant optimized byte code that was portable across implementations, but it looks to not be the case...
Hi,
..pyc's should be, cause it's standard python-bytecode, if you use massive optimizations it depends not on the os but on the underlying cpu/architecture ...
So long, Roland
You probably tried to use a bytecode file from *one* version of Python with an interpreter of another version. Python actually checks the first four bytes of the .pyc file for a compatible "magic number" before accepting the file for execution.
regards Steve
Aha! Exactly ... and that makes perfect sense too. D'oh! I guess a better
distribution strategy would be to have the installation program generate the pyo
file at installation time...
Thanks -
--
----------------------------------------------------------------------------
Tim Daneliuk tu****@tundraware.com
PGP Key: http://www.tundraware.com/PGP/
Tim Daneliuk wrote: Steve Holden wrote:
Roland Heiber wrote:
Tim Daneliuk wrote:
It does - thanks. One more question: Are pyc and pyo file portable across operating systems? I suspect not since I generated a pyo on a FreeBSD machine that will not run on a Win32 machine. I was under the impression that "compiled" meant optimized byte code that was portable across implementations, but it looks to not be the case...
Hi,
..pyc's should be, cause it's standard python-bytecode, if you use massive optimizations it depends not on the os but on the underlying cpu/architecture ...
So long, Roland You probably tried to use a bytecode file from *one* version of Python with an interpreter of another version. Python actually checks the first four bytes of the .pyc file for a compatible "magic number" before accepting the file for execution.
regards Steve
Aha! Exactly ... and that makes perfect sense too. D'oh! I guess a better distribution strategy would be to have the installation program generate the pyo file at installation time...
Thanks -
That's what most sensible distributions do.
regards
Steve
--
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005 http://www.pycon.org/
Steve Holden http://www.holdenweb.com/
Tim Daneliuk wrote: Steve Holden wrote:
Roland Heiber wrote:
Tim Daneliuk wrote: Aha! Exactly ... and that makes perfect sense too. D'oh! I guess a better distribution strategy would be to have the installation program generate the pyo file at installation time...
Thanks -
Also, the *.py? files contain the full pathname of the *.py they have
been compiled from. Copying them to other path locations will give you
the wrong __file___ information in tracebacks.
--
Vincent Wehren
Roland Heiber wrote: Tim Daneliuk wrote: under the impression that "compiled" meant optimized byte code that
You where right, i was totally mislead by "optimized" ... ;)
Greetings, Roland This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: edykstra |
last post by:
Hello,
If you point your browser to this page,
http://prdownloads.sourceforge.net/vnc-tight/tightvnc-1.2.9_x86_viewer.zip?use_mirror=umn
the server sends you the HTML page, and very soon...
|
by: skn |
last post by:
Hello.,
Does the python compiler provide an option to generate a .pyo(optimized byte
code file) from a .py (source file)?
For generating .pyc I know that I only have to pass the source file...
|
by: Mike Kennedy |
last post by:
I have an XML Snippet <?xml version="1.0" encoding="UTF-8"?> and when I
convert the entire xml file to a DOM and then generate a new file from
the DOM, results in <?xml version="1.0"?>.
Any...
|
by: daniele.balducci |
last post by:
Hi All,
I'm generating XLS files from ASP(.Net) code using the usual code
chunks ...
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", "attachment;...
|
by: Mike |
last post by:
I'm trying to generate a shortcut file from VB. The code below is a cutdown
version of some code I found on the net that is supposed to do the job
The compiler complains about "WshShell" in the...
|
by: manas589 |
last post by:
Hi
Can any one tell me how to use binding.xml while generating castor bean from an xsd file.
i have one xsd file where two element are conflicting. so i thought to use binding file while...
|
by: bizt |
last post by:
Hi,
Is it possible to obtain the width/ height of an image when that image
is dyanically created using a PHP script and passing GET attributes.
For example:
<img...
|
by: Nathan Sokalski |
last post by:
I am an ASP.NET developer, and Visual Studio 2005 seems to have stopped
declaring the controls that I add in the *.designer.vb files, therefore
forcing me to manually add them before I can use them...
|
by: Nathan Sokalski |
last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for
my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I
did anything differently than normal prior to...
|
by: csharpula csharp |
last post by:
Hello,
I need to generate cs files from XSD files. I would like to do it
automatically. What is the best way to do it? Is it better be done with
PreBuild inside VS (before compilation) or to...
|
by: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |