[New-bugs-announce] [issue12982] .pyo file cannot be imported

Eric O. LEBIGOT report at bugs.python.org
Wed Sep 14 22:32:43 CEST 2011


New submission from Eric O. LEBIGOT <eric.lebigot at normalesup.org>:

When creating a .pyo file (either with -O or -OO) and removing any .pyc or .py original file, import <module_name> complains with "No module called <module_name>".  The import does work with .pyc files.

I'm not sure that this is the correct behavior, as the documentation does not seem to make any difference between .pyc and .pyo files on this point:

"It is possible to have a file called spam.pyc (or spam.pyo when -O is used) without a file spam.py for the same module. This can be used to distribute a library of Python code in a form that is moderately hard to reverse engineer."

----------
components: Interpreter Core
messages: 144049
nosy: lebigot
priority: normal
severity: normal
status: open
title: .pyo file cannot be imported
type: compile error
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12982>
_______________________________________


More information about the New-bugs-announce mailing list