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.

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.