[Zope] python -O

Brian Lloyd Brian@digicool.com
Mon, 1 Nov 1999 12:22:08 -0500


>    Recently I tried to use "python -O", stopped Zope and 
> asked Apache to
> restart it. Zope didn't came up, and I got "temporary 
> unavail". I removed
> option "-O", and Zope started up ok.
> 
>    Question: What are pros and cons to run Zope under "python 
> -O"? If there are pros, how can I achive that?

Oleg,

I suspect that this is because PCGI is not expecting 
arguments to the Python binary (it uses exec to get
python started, and it's probably passing the arg
along as part of the program name).

If you use the "start" script with Zope 2.x, you can
add -O there and it seems to work fine - you just can't
do it if PCGI is starting the process. Note that many
of the Python command line options have corresponding
environment variables that can be set as an alternative 
- if that is the case for the -O option, you should be
able to set the env. var in your PCGI resource file.

As far as pros and cons, it may in theory be a little bit
faster (my limited performance tests using -O didn't show
much definitive improvement). On the con side, using
the -O option removes some metadata from Python bytecode
(line numbers?) which may make it more difficult for you
to debug a Zope site.

Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com