473,322 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Generating .pyo from .py

skn
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 name as
an argument to py_compile.py.
But for generating .pyo, I could not find anything.

Any clues/help will be greatly appreciated.

With best regards,
skn
Jul 19 '05 #1
3 10491
say your code is "test.py" and you usually run it as "python test.py",
then the "-O" option will generate .pyo files.
That is "python -O test.py"

Cheers maurice

skn wrote:
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 name as
an argument to py_compile.py.
But for generating .pyo, I could not find anything.

Any clues/help will be greatly appreciated.

With best regards,
skn

Jul 19 '05 #2
skn wrote:
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 name as
an argument to py_compile.py.


py_compile.py checks __debug__ to decide whether to use optimize mode,
and the -O option to Python turns __debug__ off, so:

python -O py_compile.py foo.py
Jul 19 '05 #3
skn
Thanks a lot !!
It works fine !!

regards,
skn

"Leif K-Brooks" <eu*****@ecritters.biz> wrote in message
news:JV*****************@monger.newsread.com...
skn wrote:
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 name as an argument to py_compile.py.


py_compile.py checks __debug__ to decide whether to use optimize mode,
and the -O option to Python turns __debug__ off, so:

python -O py_compile.py foo.py

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: paul | last post by:
Hi, I'd like to generate PDF files from my Php website. I've found PDFLib to make it... but i'd like to have your views. It is the best I can find ? Are there any other PDF generating lib ?...
0
by: Dan Gass | last post by:
The difflib.py module and the diff.py tools script in Python 2.4 alpha 3 now support generating side by side (with intra line differences) in HTML format. I have found this useful for performing...
0
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # David Eppstein of the Geometry Junkyard fame gave this elegant # version for returing all possible pairs from a range of n numbers. def combo2(n): return...
17
by: flupke | last post by:
Hi, i create my GUIs mainly via wxGlade. However when you start of to program and want to do some rearranging to the gui, wxglade overwrites your file and you've got to put your own code back...
3
by: Raed Sawalha | last post by:
Hello when I serialize an object an error generated using this function public string SerializeObject(object oClassObject,System.Type oClassType) { XmlSerializer oSerializer = new...
1
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...
3
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
0
by: Aswanth | last post by:
I'm Generating Reports in SSRS-2005.. Previously I got the Data from One Database & Generated Reports.. Now I used to get the Data from Two Different Databases(ie Database-1 & Database-2) & to...
0
by: Aswanth | last post by:
I'm Working with Asp.Net with C#.. & I'm Generating Reports in SSRS-2005.. Till Now I'm Generating Reports in SSRS-2005 with Stored Procedure.. in Which I'm Generating Reports for One...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.