Operations 4 min read

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.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Why My Python Debugger Failed on Ubuntu and How I Fixed It

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 parse

Initially 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-icons

After 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingPythonsystem recovery
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.