Why My Python Debugger Failed on Ubuntu and How I Fixed It
A Python developer encountered an ImportError while debugging a script on Ubuntu, traced it to a urllib module conflict, restored the Unity desktop with system commands, and finally resolved the issue by removing a stray urllib.py file that blocked PyCharm's debugger.
I wrote a Python data‑conversion script that runs but needed debugging, and when I launched PyCharm’s debugger I got an ImportError: No module named parse.
The traceback showed that pydev_imports.py tried to import urllib.parse, which exists only in Python 3, while I was running Python 2.7.
/usr/bin/python2.7 /buildtools/pycharm-2017.1/helpers/pydev/pydevd.py --multiproc --qt-support --client 127.0.0.1 --port 36360 --file /study/python/zookeeper/app.py
Traceback (most recent call last):
File "/buildtools/pycharm-2017.1/helpers/pydev/pydevd.py", line 17, in <module>
from _pydev_bundle import pydev_imports, pydev_log
File "/buildtools/pycharm-2017.1/helpers/pydev/_pydev_bundle/pydev_imports.py", line 59, in <module>
from urllib.parse import quote, quote_plus, unquote_plus #@UnresolvedImport
ImportError: No module named parseInitially I blamed PyCharm, upgraded it, but the problem persisted. I realized the issue stemmed from the code in pydev_imports.py that conditionally imports urllib for Python 2 and urllib.parse for Python 3.
After removing Python 3 from the system the error disappeared, but the Ubuntu desktop became unusable: the panel and menu vanished, leaving only a SlickEdit icon.
Using Ctrl+Alt+F6 to switch to a TTY, I restored the Unity desktop with the following commands:
sudo apt-get install dconf-tools
dconf reset -f /org/compiz/
setsid unity
unity --reset-iconsAfter reboot the desktop returned, though some applications like Update‑Manager, gedit, and the Sogou input method were missing; I reinstalled them with dpkg -i sogoupinyin_2.1.0.0082_amd64.deb and switched to Atom.
Finally I discovered a stray urllib.py file in my project directory; deleting it allowed PyCharm to debug correctly. The episode highlighted how a name clash with a standard library module can break debugging and how removing Python 3 can cripple an Ubuntu system.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
