Search code examples
pythondjangoeclipseinstallationpydev

"ModuleNotFoundError: No module named x" : Pydev configuration correct?


Really struggling with Eclipse Pydev, first time trying it out.

Trying to run shell command in python django, however I'm getting the following error:

ModuleNotFoundError: No module named 'rango'

I checked Project > Properties > PyDev - Django to see settings module and both fields saying: "settings / manage module not found...

Here is the screen: https://i.sstatic.net/006pG.jpg

Here is the stack trace:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "F:\CAB302\java-latest-released\eclipse\plugins\org.python.pydev.core_6.4.1.201806231219\pysrc\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'rango'

Is the Python Path correct? Also

I am not sure what a python path represent? (please explain). For reference Python path screen capture: https://i.sstatic.net/Is9Xc.jpg

What would be the correct path for the error in the photo one? I assume its why I am getting the ModuleNotFoundError?

Please help!


Solution

  • The problem is that your PYTHONPATH configuration is pointing to the wrong place.

    i.e.: if you want to import rango, you need to set Project/Tango (from your screenshot) as the source folder (which is the folder to be added to the PYTHONPATH).

    This is in the project properties -> PyDev - PYTHONPATH (make sure you also unset the project root from the PYTHONPATH). See: http://www.pydev.org/manual_101_project_conf2.html for details.

    In the django settings, you should remove the Project/ and Project/Tango -- the manage.py should be Tango/manage.py and the django settings module should be Tango.settings.