Stefan Falk
Stefan Falk

Reputation: 25347

Module not found when debugging

I am running a Python client using PyCharm. If I just run it, PyCharm simply calls:

C:\Python27\python.exe E:/faf/client/src

and everything is fine.

These are my settings:

enter image description here

If I want to debug it, PyCharm calls:

C:\Python27\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.2\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 52948 --file E:/faf/client/src

and the result is that the modules which are in fact there cannot be included

pydev debugger: process 5092 is connecting

Connected to pydev debugger (build 143.1184)
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.2\helpers\pydev\pydevd.py", line 2407, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.2\helpers\pydev\pydevd.py", line 1798, in run
    launch(file, globals, locals)  # execute the script
  File "E:/faf/client/src\__main__.py", line 29, in <module>
    import config
ImportError: No module named config

What do I have to do to be able to debug this thing?

Upvotes: 4

Views: 6711

Answers (2)

Devin B.
Devin B.

Reputation: 453

I resolved this issue for myself by adding an init.py in the folder of the module I was trying to import.

Upvotes: 0

Stefan Falk
Stefan Falk

Reputation: 25347

I had to click on the src directory and add it as source folder (Mark Directory As -> Source Root). No apparent thing changed like e.g. the way the python command got called.

So if you have a similar looking problem try to do the same.

Upvotes: 4

Related Questions