"run module" results in "no module named ...", but same command works in console
Hi all,
first: I have read all the other posts – and it still does not work.
The problem is that I get a “module not found” error (precisely: “No module named (censored).handlers.incoming.config”).
I configure my “Run/Debug” dialog like this:
- “Add content root to PYTHONPATH” - YES
- “Add source root to PYTHONPATH” - YES (it's the same, actually)
- run as python module
If I run python -m (censored).handlers.incoming.config
in the console – it works just fine. If I run it in PyCharm, I get a “Module not found” error (same working directory, naturally). PyCharm does that on “Debug” (somewhat shortened for brevity):
.../backend/.venv/bin/python \
-X pycache_prefix=.../Caches/JetBrains/PyCharm2024.1/cpython-cache \
.../PyCharm Professional.app/.../pydev/pydevd.py \
--module --multiprocess --qt-support=auto \
--client 127.0.0.1 --port 64543 \
--file (censored).handlers.incoming.config \
testdata/(censored).xlsx
Connected to pydev debugger (build 241.15989.155)
No module named (censored).handlers.incoming.config
Process finished with exit code 0
I am a bit confused as to why this does not work. Can somebody help?
Thanks in advance!
Axel.
Please sign in to leave a comment.
Hi @Axel Bock , can you try to mark
(censored)
directory asSources root
? Does it help?Mikhail Tarabrikov i tried that, it does not help :( …
Axel Bock , unfortunately, I am not able to reproduce it on 2024.1.4 version.
For deeper analysis would you please share logs from Help | Collect Logs and Diagnostic Data after running the module in the IDE?
Please also run the the following script from the project venv and provide the output: https://gist.github.com/aresler/22c59d7883fd57dddb4c57a7f96603d6
Please upload it to https://uploads.services.jetbrains.com and let me know the upload ID. It will not be shared anywhere outside of JetBrains and will only be used for troubleshooting of this issue.