473,289 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

feature proposal, debug on exception

There's an occasional question here about how to get python to launch
pdb on encountering an uncaught exception. The answer is to look in
some ASPN recipe and do some weird magic. I guess that works, but
it's another thing to remember or keep looking up when the occasion
arises (some program crashes unexpectedly). I find myself manually
adding tracing instead, finding out that I did it wrong and having to
re-launch a long-running program, etc.

I'd like to propose that debug-on-exception be made into a standard
feature that is easy to enable, e.g. with a command line option
or with a simple pdb call immediately after the import:

import pdb
pdb.debug_on_exception(True)
...

Would there be big obstacles to this? It would have saved me
considerable hassle on a number of occasions. I'm constantly
processing large data sets that will munch along happily for hours and
hours before hitting some unanticipated condition in the data, and it
would be great to trap immediately rather than have to analyze the
resulting stack dump and restart.
Jun 27 '08 #1
3 931
On May 20, 5:59 pm, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
There's an occasional question here about how to get python to launch
pdb on encountering an uncaught exception. The answer is to look in
some ASPN recipe and do some weird magic. I guess that works, but
it's another thing to remember or keep looking up when the occasion
arises (some program crashes unexpectedly). I find myself manually
adding tracing instead, finding out that I did it wrong and having to
re-launch a long-running program, etc.

I'd like to propose that debug-on-exception be made into a standard
feature that is easy to enable, e.g. with a command line option
or with a simple pdb call immediately after the import:

import pdb
pdb.debug_on_exception(True)
...

Would there be big obstacles to this? It would have saved me
considerable hassle on a number of occasions. I'm constantly
processing large data sets that will munch along happily for hours and
hours before hitting some unanticipated condition in the data, and it
would be great to trap immediately rather than have to analyze the
resulting stack dump and restart.

This is not exactly an answer to your proposal, I know, but FWIW
Ipython has exactly this capability.

Regards,
~S
Jun 27 '08 #2
On May 21, 10:59 am, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
I'd like to propose that debug-on-exception be made into a standard
feature that is easy to enable, e.g. with a command line option
or with a simple pdb call immediately after the import:
Forgive me if I've missed your point, but it seems you can already do
this:

pdb.py can also be invoked as a script to debug other scripts.
For example:

python -m pdb myscript.py

When invoked as a script, pdb will automatically enter post-mortem
debugging if the program being debugged exits abnormally. After
post-mortem debugging (or after normal exit of the program), pdb
will restart the program. Automatic restarting preserves pdb's
state (such as breakpoints) and in most cases is more useful than
quitting the debugger upon program's exit. New in version 2.4:
Restarting post-mortem behavior added.

http://docs.python.org/lib/module-pdb.html
Jun 27 '08 #3
Simon Forman <sa*******@gmail.comwrites:
This is not exactly an answer to your proposal, I know, but FWIW
Ipython has exactly this capability.
Yes.

When you %run a scripts and get exception, you can launch post-mortem
pdb on it by typing %debug.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Lonnie Princehouse | last post by:
In a recent post, Michele Simionato asked about resumable (or re-entrant) exceptions, the basic idea being that when raised and uncaught, these exceptions would only propagate backwards through a...
3
by: flexibal | last post by:
hi there. i didnt know if i should post it at python-dev or here, so i'll start here. i'd like to suggest a new language feature for python that allows you to explicitly declare a variable. ...
4
by: christopher diggins | last post by:
A feature that I find signficantly missing in C# is the ability to write functions in interfaces that can call other functions of the interface. Given an interface ISomeInteface the only way we can...
32
by: James Curran | last post by:
I'd like to make the following proposal for a new feature for the C# language. I have no connection with the C# team at Microsoft. I'm posting it here to gather input to refine it, in an "open...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
30
by: Raymond Hettinger | last post by:
Proposal -------- I am gathering data to evaluate a request for an alternate version of itertools.izip() with a None fill-in feature like that for the built-in map() function: >>> map(None,...
12
by: Raymond Hettinger | last post by:
I am evaluating a request for an alternate version of itertools.izip() that has a None fill-in feature like the built-in map function: >>> map(None, 'abc', '12345') # demonstrate map's None...
23
by: dhtmlkitchen | last post by:
JSON We all know what it is. In ECMAScript 4, there's a JSON proposal: Object.prototype.toJSONString String.prototype.parseJSON The current proposal, String.prototype.parseJSON, returns...
12
by: Ioannis Vranos | last post by:
Perhaps a mechanism can be introduced in the C++0x/1x standard, something simple like defining a function as: void somefunc(void) throw() { // ... }
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.