How I messed up python pdb

previously, I had pdb installed system-wide using pip install

, a little after I found out about ipdb

. installed it successfully using pip. Not really good, I decided to go back to the old pdb. Now I am getting error usingimport pdb; pdb.set_trace()

exceptions.AttributeError: 'module' object has no attribute 'set_trace'

Any idea what's going wrong?

EDIT: This is an error after reinstalling IPython and PDB again:

File "/usr/local/lib/python2.7/dist-packages/IPython/core/debugger.py", line 59, in from pdb import Pdb as OldPdb ImportError: Unable to import Pdb name

+3


source to share


3 answers


I managed to solve the problem. Apparently there is another module in the pip repository called pdb

for collaborative password management. every time pip install pdb

I tried, I didn't know my machine was installing the wrong module. The module pdb

(python debugger) comes with the product when it is installed on your system or in the case of Linux Ubuntu, it is included in the distribution that is in /usr/lib/python2.7

, as opposed to third-party modules that are installed under /usr/local/lib/python2.7

. For some strange, unknown reason (I'm guessing the ipdb installation caused this), I didn't have pdb.py under my pre-loaded python modules. eg,/usr/lib/python2.7

... that my problem was downloading the pdb.py module from the python documentation site and placing that file in the specified folder. Hope this helps.



+6


source


try cmd and check the weather if pdb is listed or not:

pip freeze 

      

Here will be a list of all pkgs installed with python checkout,

also if you try this:



 pip uninstall pdb
 Cannot uninstall requirement pdb, not installed
 Storing debug log for failure in /tmp/tmpVgAfBP

      

can you confirm the output:

 pip uninstall pdb

      

+2


source


Yes. I faced the same problem today and the solution is the same as above, try analyzing by typing pip freeze | grep pdb

and you can see:

ipdb==0.9.0

pdb==0.1

      

This means you installed pdb yourself and this covered ipdb, after removing pdb for ppb you should keep

ipdb==0.9.0

      

Staying!

+2


source







All Articles