Why optparse wont import?

Jorge Godoy godoy at ieee.org
Fri Jan 20 18:41:55 EST 2006


Karlo Lozovina <_karlo_ at _mosor.net_> writes:

> If I create a file with only one line:
>
> ---
> from optparse import OptionParser
> ---
>
> I get this when I try to run it from "DOS" prompt:
>
> Traceback (most recent call last):
>   File "optparse.py", line 1, in ?
>     from optparse import OptionParser
>   File "X:\data\other\source\python\population\optparse.py", line 1, in ?
>     from optparse import OptionParser
> ImportError: cannot import name OptionParser
>
> When I try to do that from Python prompt everything works fine. What's the 
> problem?

Rename your file to something other than optparse.py...  

-- 
Jorge Godoy      <godoy at ieee.org>

"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.



More information about the Python-list mailing list