473,408 Members | 1,904 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,408 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 934
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.