Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I cannot import a module into python

I’m taking a django course and when I go to put urls, it’s causing this problem:
enter image description here

Code:
enter image description here

Folder structure:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

This is because of absolute imports being in effect (more precisely, the lack of implicit relative imports) for Python 3 and the fact that the pyping module was most likely only written for Python 2. Whereas in Python 2 you can do:

from core.views import home

In Python 3 (or if you have from __future__ import absolute_import in Python 2), you have to do:

from .core.views import home

or

from pyping.core.views import home

You can try this.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading