PyCharm debugger not working with specific environment
When trying to remote debug with one of my Python environments I get an error, with console output shown below. If just try to run (no debug) the program runs fine. Also, I'm only experiencing this problem with this specific environment (conda envs for other projects work fine). I tried removing the "import requests" line, but I got another error, which is shown below the first one.
File "home_dir/.pycharm_helpers/pydev/pydevd.py", line 15, in <module>
from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY34_OR_GREATER, IS_PY36_OR_GREATER, IS_PYCHARM, get_thread_id, \
File "home_dir/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_constants.py", line 168, in <module>
from _pydev_imps._pydev_saved_modules import thread
File "home_dir/.pycharm_helpers/pydev/_pydev_imps/_pydev_saved_modules.py", line 21, in <module>
import xmlrpc.client as xmlrpclib
File "home_dir/.conda/envs/opensim-rl/lib/python3.6/xmlrpc/client.py", line 136, in <module>
import http.client
File "home_dir/code/project_folder/osim-rl/osim/http/client.py", line 2, in <module>
import requests
File "home_dir/.conda/envs/opensim-rl/lib/python3.6/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "home_dir/.conda/envs/opensim-rl/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "home_dir/.conda/envs/opensim-rl/lib/python3.6/site-packages/urllib3/connectionpool.py", line 11, in <module>
from .exceptions import (
File "home_dir/.conda/envs/opensim-rl/lib/python3.6/site-packages/urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
ImportError: cannot import name 'IncompleteRead'
-------------------------------------------
File "home_dir/.pycharm_helpers/pydev/pydevd.py", line 15, in <module>
from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY34_OR_GREATER, IS_PY36_OR_GREATER, IS_PYCHARM, get_thread_id, \
File "home_dir/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_constants.py", line 168, in <module>
from _pydev_imps._pydev_saved_modules import thread
File "home_dir/.pycharm_helpers/pydev/_pydev_imps/_pydev_saved_modules.py", line 22, in <module>
import xmlrpc.server as _pydev_SimpleXMLRPCServer
File "home_dir/.conda/envs/opensim-rl/lib/python3.6/xmlrpc/server.py", line 108, in <module>
from http.server import BaseHTTPRequestHandler
ModuleNotFoundError: No module named 'http.server'
请先登录再写评论。
Hi @Lep,
Is it reproducible in another project with the same Project Interpreter or in the same project but different Project Interpreter?
I'm curious if it's related to the interpreter, project or both.
Also, what's your PyCharm version?
HI Sergey,
Thanks for the reply. The problem seems to be related to the project, based on two tests:
1.) Same project + different interpreter throws the same error when trying to debug.
2.) Created new project using the same interpreter, tried "import requests", which is the line that triggers the error, and it works fine.
My PyCharm version is 2018.3.3 (Professional Edition)
Do you have any custom modules which may conflict with built-in ones?
For example, some python file named http?
Yes. Looks like the problem was caused by one of my submodules. Thanks a lot for the quick help!