How to optimised with embedded Python ?

E

Emmanuel

Hi,

I would like to use optimised python scripts ( *.pyo ), in order to gain
space.
But I use an embedded python. The compiler can only be run from my
application.
How do I set the compiler, from the C api, to create optimised files ?

Thanks by advance,

Emmanuel
 
J

John J. Lee

Emmanuel said:
I would like to use optimised python scripts ( *.pyo ), in order to gain
space.
But I use an embedded python. The compiler can only be run from my
application.
How do I set the compiler, from the C api, to create optimised files ?

There's a "compileall" script in the source distribution that should
show you how to do it.


John
 
E

Emmanuel

Actually, I found a solution :
Just after the python initialize, I increment Py_OptimsedFlag :

(...)
Py_Initialize();
Py_OptimizeFlag++;
(...)

Works like a charm !!

Thanks for your help,

Emmanuel

"John J. Lee" a écrit :
 
J

John J. Lee

Emmanuel said:
"John J. Lee" a écrit :
There's a "compileall" script in the source distribution that should
show you how to do it.
[...]
Actually, I found a solution :
Just after the python initialize, I increment Py_OptimsedFlag :
[...]

Oh, sorry, I completely misread your question. I missed the "C API"
bit...


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top