Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost in pudb command line area

Tags:

python

pudb

I'm starting to use pudb for Python debugging. It comes up fine, and I can step through, and it stops at breakpoints I put into code with pudb.set_trace(). So far so good. The main problem I'm having is this:

If I hit ^X to get to the command-line pane, I can type executable lines or variable names, like running interactive Python, but the slightest typo (or experiment in search of other commands, or request for help()) lands me in a state I can't recover from. Even Control-c (as claimed at https://docs.python.org/2/tutorial/appendix.html#tut-interac) just shows up as "^C" and does nothing.

For example, if I type "help()", it prints some Python (not pudb) help, redisplays "help()" in yellow, and then I'm dead in the water. Backspace won't affect the "help()" that's displayed, and ^H just gets displayed as caret + H -- until I hit return, when it seems to be appended to "help()" as literal backspaces, since I can make part of all of "help()" disappear. I can type anything after "help()", but I always get:

SyntaxError: unexpected EOF while parsing

followed by a redisplay of what I had typed. How do I "clear" this state and get back to the normal command line, short of quitting my terminal program?

Using Terminal on Mac OS X 10.9.5, though I can also try Linux.

like image 324
TextGeek Avatar asked Oct 31 '14 14:10

TextGeek


1 Answers

Your description points not to a problem with pudb but rather to a problem with behaviour of Backspace on the Terminal you're using.

Please try changing this behaviour so it's sending the proper Backspace. This could be helpful: http://fredericiana.com/2006/10/16/fixing-backspace-and-delete-for-ssh-in-os-xs-terminalapp/

Then, you should be able to enter pudb's full screen Python interpreter by '!' and leave it by Control-D.

A "small" Python command line inside pudb's interface can be accessed by Control-X and you can leave it by Control-X. In this one you have three other shortcuts which also let you manipulate the command line: Control-V - insert new line and Control-N/Control-P to browse command line history. If any of these is not working it's rather an issue with the way the Terminal treats these shortcuts and not in the way pudb does.

like image 180
BartoszGo Avatar answered Nov 12 '22 19:11

BartoszGo