[docs] [issue12982] .pyo file can't be imported unless -O is given

Éric Araujo report at bugs.python.org
Tue Jun 12 15:15:58 CEST 2012

Éric Araujo <merwok at netwok.org> added the comment:

Michael, I don’t think your proposed change would be considered favorably: importing .pyc or .pyo is well defined for CPython and the -O switch is really required for .pyo.  However you may be able to import them anyway without any change to Python if you write a custom importer (more info in PEP 302 and the import docs) which reuses the low-level imp module to find and load .pyo files.


Python tracker <report at bugs.python.org>

More information about the docs mailing list