pdb-python

Debugging python programs in emacs

How to debug python programs in emacs? I use python-mode.el I get reference like import pdb; pdb.set_trace(); but not sure how to use it. ...

Why can't I break into a running test with the pdb interactive debugger?

How can I break into a running test with the pdb interactive debugger? This is the test: class UserTestCase(TestCase): def test_register_should_create_UserProfile(self): c = Client() response = c.post('/account/register/', {u'username': [u'john'], u'email': [u'[email protected]'], u'bnewaccount': [u'Signup']}) self.assert...

Any way of achieving the same thing as python -mpdb from inside the script?

Besides wrapping all your code in try except, is there any way of achieving the same thing as running your script like python -mpdb script? I'd like to be able to see what went wrong when an exception gets raised. ...

pdb show different variable values than print statements

Hi, everyone. I am debugging a python module with homemade c extensions. The output seems correct when I print it with 'p' in pdb. But if I use a normal print statement or pickle it, the output is wrong. What could be causing pdb to show different values than normal execution? I can even step to the print statement in debug mode, an...

Why is iPdb not displaying STOUT after my input?

I can't figure out why ipdb is not displaying stout properly. I'm trying to debug why a test is failing and so I attempt to use ipdb debugger. For some reason my Input seems to be accepted, but the STOUT is not displayed until I (c)ontinue. Is this something broken in ipdb? It makes it very difficult to debug a program. Below is an ex...

Python (pdb) - Queueing up commands to execute

I am implementing a "breakpoint" system for use in my Python development that will allow me to call a function that, in essence, calls pdb.set_trace(); Some of the functionality that I would like to implement requires me to control pdb from code while I am within a set_trace context. Example: disableList = [] def breakpoint(name=None)...

Can I debug with python debugger when using py.test somehow?

I am using py.test for unit testing my python program. I wish to debug my test code with the python debugger the normal way (by which i mean pdb.set_trace() in the code) but I can't make it work. Putting pdb.set_trace() in the code doesn't work (raises IOError: reading from stdin while output is captured). I have also tried running py....

Emacs gud raising prefix key error

I'm trying to debug code in Emacs but when I try either M-x gdb or M-x pdb, I get this error: global-set-key: Key sequence C-x C-a C-l starts with non-prefix key C-x C-a This is most likely coming from this bit in gud.el: (defcustom gud-key-prefix "\C-x\C-a" "Prefix of all GUD commands valid in C buffers." :type 'string :group ...

Is there anyway to get pdb and Mac Terminal to play nicely?

When debugging my django apps I use pdb for interactive debugging with pdb.set_trace(). However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset. Is there anyway for this to happen automatically? It can be real annoying, having to cancel the runserver and reset...

PDB: exception when in console - full stack trace

When at the pdb console, entering a statement which causes an exception results in just a single line stack trace, e.g. (Pdb) someFunc() *** TypeError: __init__() takes exactly 2 arguments (1 given) However I'd like to figure out where exactly in someFunc the error originates. i.e. in this case, which class __init__ is attached to. ...

A Python IDE with Debugging and iPython Integration?

Does anyone know of a python IDE that has iPython as the interpreter? Using the standard interpreter just drives me nuts, as I've just grown to love using iPython and all the features it provides. To be honest, I'd rather code with a simple text editor + ipython than an IDE, but I love being able to set breakpoints with a click of a ...

pdb is not working in django doctests

So I created the following file (testlib.py) to automatically load all doctests (throughout my nested project directories) into the __tests__ dictionary of tests.py: # ./testlib.py import os, imp, re, inspect from django.contrib.admin import site def get_module_list(start): all_files = os.walk(start) file_list = [(i[0], (i[1], ...

Stepping over a yield statement

When in the Python debugger (pdb) I want to step over a yield statement, but hitting (n) for next brings me to the destination of the yield i.e. the consumer of the generator. I want to go to the next line that is executed within the generator. Is there any way to do this? I'm using Python 2.6 ...

running pdb from within pdb

I'm debugging an script that I'm writing and the result of executing a statement from pdb does not make sense so my natural reaction is to try to trace it with pdb. To paraphrase: Yo dawg, I like python, so can you put my pdb in my pdb so I can debug while I debug? ...

Run pdb without stdin/stdout using FIFO

I am developing FUSE filesystem with python. The problem is that after mounting a filesystem I have no access to stdin/stdout/stderr from my fuse script. I don't see anything, even tracebacks. I am trying to launch pdb like this: import pdb pdb.Pdb(None, open('pdb.in', 'r'), open('pdb.out', 'w')).set_trace() All works fine but very...

Step into subroutine call, but not calls made for parameters

func(a(), b.c) When executing the line above in the pdb debugger, using step will actually step into a, and then into the getter for b.c if its atypical (such as being a property), before actually stepping into func. Generally I find myself using step followed by r to return from the frames I'm not interested in, and often inexplicabl...

What is best way for interactive debug in python?

I want to utilize introspection capability of python for debugging/development, but cannot find appropriate tool for this. I need to enter into shell (IPython for example) at specific position or at specific event (like exception), with locals and globals of shell being set to the frame's ones. My own quick hack to illustrate it: impo...

Can I get Python debugger pdb to output with Color?

I'm using PDB a lot and it seems it would be even better if I could add systax highlighting in color. Ideally, I'd like to have to the path to the code a lighter color. The line of actual code would be syntax highlighted. I'm using OS X and the Terminal app. Python 2.7 ...

Getting pdb in emacs to use python process from current virtualenv

I am debugging some python code in emacs using pdb and getting some import issues. The dependencies are installed in one of my bespoked virtualenv environments. Pdb is stubbornly using /usr/bin/python and not the python process from my virtualenv. I use virtualenv.el to support switching of environments within emacs and via the posta...

Django UnicodeDecodeError when using pdb

I've notice every time I put an: import pdb; pdb.set_trace() in My Spanish Django project, if I have a specific Unicode character in a string like: Gracias por tu colaboración I get a UnicodeDecodeError with an 'ordinal not in range(128)' in a Django Debug window. The problem is that I can not debug my application easily. On the ot...