question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot import name 'message_from_file'

See original GitHub issue

When I try adding 'django_rest_passwordreset' to django apps, I get this error:

Traceback (most recent call last):
  File "manage.py", line 28, in <module>
    from django.core.management import execute_from_command_line
  File "/home/giovanni/git/ozzy-backend/venv/lib/python3.6/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/giovanni/git/ozzy-backend/venv/lib/python3.6/site-packages/django/utils/version.py", line 6, in <module>
    from distutils.version import LooseVersion
  File "/home/giovanni/git/ozzy-backend/venv/lib/python3.6/distutils/__init__.py", line 25, in <module>
    from distutils import dist, sysconfig
  File "/usr/lib64/python3.6/distutils/dist.py", line 10, in <module>
    from email import message_from_file
ImportError: cannot import name 'message_from_file'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 34, in <module>
    ) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

And removing it my app runs fine. Can you help me with this issue? This has something to do with the email package?

Django: 2.1.2 Python: 3.6 Using virtualenv.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
anx-ckreuzbergercommented, Mar 8, 2019

@giovannicimolin @saurabhaec Do you happen to have a file called “email.py” (or a folder called “email”) somewhere within your project?

0reactions
rinshankolayilcommented, Aug 7, 2019

@anx-ckreuzberger : Aah may be there is one. I will check and tell you.Anyway thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Showing ImportError: cannot import name 'Message' from 'can'
It's some kind of import bug. Try import Message like this: from can.message import Message. Everything worked for me.
Read more >
email.parser: Parsing email messages — Python 3.11.1 ...
The BytesFeedParser , imported from the email.feedparser module, provides an API that is conducive to incremental parsing of email messages, such as would ......
Read more >
ImportError: cannot import name 'OperationMessage · Issue #97
I installed syft-proto from source. Traceback (most recent call last): File "run_websocket_client.py", line 10, in import syft as sy File ...
Read more >
cannot import name 'Message' from 'can' in my Ubuntu - Unix ...
I found this solution that worked for me: Try pip3 uninstall python-can but with "sudo" permissions. Raspberry Pi will work this out, ...
Read more >
eMaRC Plus V: Configuring PHINMS Queue - CDC
e.g. We cannot have folder name like My Documents/HL7 Files. c. Importing message from file may take several minutes depending upon file-size.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found