0

Another user successfully imports xml. When I try to import xml, Python can't find the module. Why is that?

My traceback:

>>> import xml
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "xml.py", line 13, in <module>
 from xml.etree import ElementTree as ET
ImportError: No module named etree

This is on Linux.

rypel
4,8742 gold badges27 silver badges36 bronze badges
asked Sep 3, 2014 at 10:23

1 Answer 1

3

You have a local module named xml.py; this masks the built-in package.

You'll have to rename that package; it is importing itself otherwise.

answered Sep 3, 2014 at 10:25
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.