473,320 Members | 1,820 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,320 software developers and data experts.

Can pdb be set to break on warnings?

Hello,

I use pdb under Linux to debug my Python code, as in:

python -m pdb myprogram.py

By default it does a postmortem of unhandled exceptions, is there a way
to get it to break on warnings?

Thanks a lot,
Lorcan.

Oct 11 '06 #1
6 6886
LorcanM wrote:
I use pdb under Linux to debug my Python code, as in:

python -m pdb myprogram.py

By default it does a postmortem of unhandled exceptions, is there a way
to get it to break on warnings?
is

python -m pdb -Werror myprogram.py

what you're looking for ?

</F>

Oct 11 '06 #2
Fredrik Lundh wrote:
LorcanM wrote:
I use pdb under Linux to debug my Python code, as in:

python -m pdb myprogram.py

By default it does a postmortem of unhandled exceptions, is there a way
to get it to break on warnings?

is

python -m pdb -Werror myprogram.py

what you're looking for ?

</F>

It sounds like what I want, but it doesn't work for me. When I try the
above line of code, it replies:
Error: -Werror does not exist

I'm running Python 2.4.3

Thanks for the help,
Lorcan.

Oct 11 '06 #3
"LorcanM" wrote:
> python -m pdb -Werror myprogram.py

It sounds like what I want, but it doesn't work for me. When I try the
above line of code, it replies:

Error: -Werror does not exist

I'm running Python 2.4.3
sorry, pilot cut and paste error. try:

python -Werror -m pdb myprogram.py

(-m script must be the last option before the script arguments, for pretty
obvious reasons).

</F>

Oct 11 '06 #4
At Wednesday 11/10/2006 07:31, LorcanM wrote:

python -m pdb -Werror myprogram.py
It sounds like what I want, but it doesn't work for me. When I try the
above line of code, it replies:
Error: -Werror does not exist
Try: python -h
--
Gabriel Genellina
Softlab SRL

__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas

Oct 11 '06 #5

Fredrik Lundh wrote:
"LorcanM" wrote:
python -m pdb -Werror myprogram.py
It sounds like what I want, but it doesn't work for me. When I try the
above line of code, it replies:

Error: -Werror does not exist

I'm running Python 2.4.3

sorry, pilot cut and paste error. try:

python -Werror -m pdb myprogram.py

(-m script must be the last option before the script arguments, for pretty
obvious reasons).

</F>

Thanks for that - that does the trick,
Lorcan.

Oct 11 '06 #6
This seems like very useful information. In the documentation I've
been maintaining for the extended python debugger
(http://bashdb.sf.net/pydb) I've added this as a little footnote:
http://bashdb.sourceforge.net/pydb/p....html#foot1113

However since pydb allows for options on it's own, I wonder if there
might not be a way do this from *inside* a Python
debugger/program. Specifically so that when an execfile is called, it
is as though -Werror were given initially. Possibly by setting
sys.warnoptions? Anyone know offhand if that or something else will
work?

I'll do the testing myself if someone can give a small python program
that gives such a warning. (I realize most people contributing to
comp.lang.python write programs flawlessly the first time so they've
never come across such a warning message either, let alone have need
for a debugger; but this thread suggested that the perhaps there might
such a person who has seen a Python warning message exists. :-)

"Fredrik Lundh" <fr*****@pythonware.comwrites:
"LorcanM" wrote:
python -m pdb -Werror myprogram.py
It sounds like what I want, but it doesn't work for me. When I try the
above line of code, it replies:

Error: -Werror does not exist

I'm running Python 2.4.3

sorry, pilot cut and paste error. try:

python -Werror -m pdb myprogram.py

(-m script must be the last option before the script arguments, for pretty
obvious reasons).

</F>
Oct 14 '06 #7

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

Similar topics

10
by: Kylotan | last post by:
I have the following code: def IntToRandFloat(x): """Given a 32-bit integer, return a float in """ x = int(x) x = int(x << 13) ^ x return...
3
by: Terry Richards | last post by:
mysql 4.1.9-standard how do i find exactly what the warnings are when i only get Query OK, 1 row affected, 1 warning (0.00 sec) :-)^2
30
by: prasanna | last post by:
i will be very thankful if you sent all the errors and warnings regarding to the language C thank you
22
by: John Fisher | last post by:
void f(int p) { } Many (most?) compilers will report that p is unreferenced here. This may not be a problem as f may have to match some common prototype. Typically pointers to functions are...
6
by: pete142 | last post by:
When I compile this code: typedef unsigned char BYTE; BYTE * IpString(unsigned int ip) { static BYTE ipString; ipString = (BYTE) 0xff & (ip >24); ipString = (BYTE) 0xff & (ip >16);
3
by: gil | last post by:
Hi, I'm trying to find the best way to work with compiler warnings. I'd like to remove *all* warnings from the code, and playing around with the warning level, I've noticed that compiling with...
3
by: David Mathog | last post by:
I have a program for which this line: if(! lstrtol(&atoken,length-2,(long *) &(lclparams->pad)) || (lclparams->pad< 0)){ generates the warning below, but ONLY if the gcc compiler is at -O2 or...
1
by: billiejoex | last post by:
Hi there, into a module of mine I 'warn' a message if a certain situation occurs: def add_anonymous_user(permissions=('r'): if 'w' in p: import warnings warnings.warn("it's not rencommended...
1
by: Robert Singer | last post by:
Platform: winXP, excel 2003 Python 2.5.2 XLWriter 0.4a3 (http://sourceforge.net/projects/pyxlwriter/) Is anyone here using this very nice package, for writing excel files? I'm using it on...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.