ImportError: "No Module named xxx"

John Machin sjmachin at lexicon.net
Fri Jul 6 19:52:43 EDT 2007


On Jul 7, 7:37 am, Robert Dailey <rcdai... at gmail.com> wrote:
> On Jul 6, 4:04 pm, Bjoern Schliessmann <usenet-
>
>
>
> mail-0306.20.chr0n... at spamgourmet.com> wrote:
> > Robert Dailey wrote:
> > > The description of -m is confusing in the documentation, what does
> > > it really do?
>
> > IMHO, it's quite clear. What's unclear with this description:
>
> > -m module-name    Searches sys.path for the named module and runs
> >                   the corresponding .py file as a script.
>

>
> Perhaps the confusing part is their definition of "Script".

"They" have not provided a definition of "script", confusing or
otherwise.

"runs ... as a script" means like what happens when you do this:
    python compile.py

>  I figured
> any .py file was a "python script", in that it has code to execute-
> making it a script.

Not necessarily; a .py file can be intended solely for import, and
would do nothing useful/visible if executed as a script.

However, back to your problem ......

The documentation for -m says "module-name". The error message says
"No module named compile.py". The name of the module is "compile", not
"compile.py". If you are desperate to use the -m option, do this:
    python -m compile




More information about the Python-list mailing list