Hello everyone ..

Im new in python and i have a question !

How to compile myfile.py to myfile.pyo ?

Can you give me an example script coz i dont know were to put python -0 to compile it into pyo !

Thanks a lot ..

Recommended Answers

http://www.velocityreviews.com/forums/t346147-generating-pyo-from-py.html

If it is not clear from the example, those are command line scripts; i.e., what you use to start up python in the first place.

Jump to Post

I am not familliar with pys60... I suppose you could manually force a compile.

try making a script that is in the same directory called compileme.py:

import py_compile
py_compile.compile("yourscript.py")

save, and run it.

This may end up with a .pyc file, though (it shouldnt be any …

Jump to Post

All 5 Replies

im using pys60 and i want to compile myfile.py to myfile.pyo ! Is there a example code on how to compile ? coz i dont have any idea ..

I am not familliar with pys60... I suppose you could manually force a compile.

try making a script that is in the same directory called compileme.py:

import py_compile
py_compile.compile("yourscript.py")

save, and run it.

This may end up with a .pyc file, though (it shouldnt be any different, I believe)... and that's also assuming py_compile is included with your distribution of python...

Look under PYTHONOPTIMIZE in the Python manual.

pyo, is os dependent i think, and there is no way to compile a py to pyo on the phone. you can compile or decompile py/pyc files using many apps out there as symbian packages (e.g. BestDeCompiler.sis).
if you make a pyo on pc from a pys60 script, i think it wont run on your phone.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.