I have a module that conflicts with a built-in module. For example, a myapp.email
module defined in myapp/email.py
.
I can reference myapp.email
anywhere in my code without issue. However, I need to reference the built-in email module from my email module.
# myapp/email.py
from email import message_from_string
It only finds itself, and therefore raises an ImportError
, since myapp.email
doesn't have a message_from_string
method. import email
causes the same issue when I try email.message_from_string
.
Is there any native support to do this in Python, or am I stuck with renaming my "email" module to something more specific?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…