En Thu, 24 Dec 2009 12:32:47 -0300, Boris Arloff <boris.arl...@yahoo.com>
escribió:
All python docs and description indicate that optimization (-OO) does
not do much anything except the removal off pydoc. A single "O" removes
comments and asserts, and with the removal of pydoc with double "O"
option the *.pyo byte compile is left with pure executable code. I am
experiencing a different behavior than described.
I am running Python 2.6.4 and have source code which I pre-compile
either into pyc or pyo files depending on the optimization switch
selected. The pyo version fails to run with the main program module
failing to import any other modules, such as failing on the "import os"
statement (first line encountered). However, the pyc version succeeds
and runs correctly. This is with the same code modules, same python VM
and same machine. [...]
If you start the interpreter with "python" (no optimization), it will
always look for .pyc files -- .pyo files are ignored.
If you start the interpreter with "python -O" or "python -OO", it will
always look for .pyo files -- .pyc files are ignored.
Same applies for any implicit invocation, like a shebang line -- if it
says e.g. #!/usr/env/python it will only search for .pyc files, not .pyo
Try the -v option to see which modules are loaded from where exactly.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list