Why optparse wont import?

K

Karlo Lozovina

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?
 
J

Jorge Godoy

Karlo Lozovina said:
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 <[email protected]>

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,796
Messages
2,569,645
Members
45,367
Latest member
Monarch

Latest Threads

Top