2

I am using PyCharm along with Python 3.6 from a virtual environment and when debugging (not when running) a script I get the following error:

/home/developer/master/bin/python3 /snap/pycharm-community/155/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 34977 --file /home/developer/motionplanningthesishector/Planner/control/studywolf_control/controllers/ilqr_truck.py Traceback (most recent call last): File "/snap/pycharm-community/155/helpers/pydev/pydevd.py", line 20, in <module> from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PYCHARM, get_thread_id, get_current_thread_id, \ File "/snap/pycharm-community/155/helpers/pydev/_pydevd_bundle/pydevd_constants.py", line 183, in <module> from _pydev_imps._pydev_saved_modules import thread File "/snap/pycharm-community/155/helpers/pydev/_pydev_imps/_pydev_saved_modules.py", line 22, in <module> import xmlrpc.server as _pydev_SimpleXMLRPCServer File "/usr/lib/python3.6/xmlrpc/server.py", line 115, in <module> import pydoc File "/usr/lib/python3.6/pydoc.py", line 67, in <module> import platform File "/usr/lib/python3.6/platform.py", line 116, in <module> import sys, os, re, subprocess File "/usr/lib/python3.6/subprocess.py", line 50, in <module> import signal File "/home/developer/motionplanningthesishector/Planner/control/studywolf_control/controllers/signal.py", line 18, in <module> import numpy as np File "/home/developer/master/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module> from . import core File "/home/developer/master/lib/python3.6/site-packages/numpy/core/__init__.py", line 100, in <module> from . import _internal File "/home/developer/master/lib/python3.6/site-packages/numpy/core/_internal.py", line 20, in <module> IS_PYPY = platform.python_implementation() == 'PyPy' AttributeError: module 'platform' has no attribute 'python_implementation' 

My Python installation seems correct because I can debug other files that I had created in the past but cannot debug any script newly created.

1 Answer 1

2

I see a problem in this part of the traceback:

 File "/usr/lib/python3.6/subprocess.py", line 50, in <module> import signal 

Module subprocess imports signal. It must be this one; in your directory structure it must be /usr/lib/python3.6/signal.py. But instead it tries

 File "/home/developer/motionplanningthesishector/Planner/control/studywolf_control/controllers/signal.py", line 18, in <module> 

I suspect the problem is in wrong sys.path or $PYTHONPATH.

Sign up to request clarification or add additional context in comments.

3 Comments

Good catch. Issue could also be a wrong working directory which gives the import preference above the libraries.
I understand, is confusing a name from CPython module with a script in my project, what can I do if I don't want to change the name of the script in the project? (As it is a cloned repo)
If it's a script or a top-level module there is no other way but to rename it. Scripts or user-created top-level modules or packages must not overshadow Python modules/packages. Never name you scripts, modules or packages email, test, etc. If it's not a top-level module — remove its directory from $PYTHONPATH.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.