Start the interactive shell within an application

Ben Charrow bcharrow at csail.mit.edu
Tue Jun 9 11:40:49 EDT 2009


If you're looking to debug your program, try "import pdb" and then wherever you
want to debug put:

pdb.set_trace()

Your program will then enter the debugger when it executes that line.  It's
quite nice really.  If you get confused on what to do, just type "help"

http://docs.python.org/library/pdb.html

Cheers,
Ben

Javier Collado wrote:
> Take a look either at code.interact or at
> IPython.ipapi.launch_new_instance. Basically, the only thing that you
> have to provide is a dictionary object that contains the namespace
> that you would like to have in your shell once it's launched.
> 
> Best regards,
>     Javier
> 
> 2009/6/9 eGlyph <eglyph at gmail.com>:
>> On Jun 9, 11:49 am, Jean-Michel Pichavant <jeanmic... at sequans.com>
>> wrote:
>>> I'm sometimes tired of adding prints to scan the current namespace so
>>> I'd like to pause the execution and give the user the shell prompt.
>>> This is obviously for debugging purpose.
>> This is definitely doable, have look at rhythmbox or gedit - they
>> provide an interactive console.
>> Also, have a look at IPython, they have a recipe and an example of
>> embedding IPython into a user's application.
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>



More information about the Python-list mailing list