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

Issue with exception info formatting by traceback module

Hi:

There is a difference between exception info formatting by
the interpreter versus the traceback module. For example,
say we define an exception Error in file module.py:

[jand@localhost jand]$ python
Python 2.3 (#1, Sep 12 2003, 15:05:00)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import module
raise module.Error("test") Traceback (most recent call last):
File "<stdin>", line 1, in ?
module.Error: test try: .... raise module.Error("test")
.... except:
.... import traceback
.... print traceback.print_exc()
....
Traceback (most recent call last):
File "<stdin>", line 2, in ?
Error: test
None


In the second case, only the basename of the error is reported,
which is less clear. This is relevant because the unittest framework
uses the traceback module for exception reporting.

I believe the traceback module should be modified to mimic the
interpreter's behavior.

Regards, jan

--
Jan Decaluwe - Resources bvba - http://jandecaluwe.com
Losbergenlaan 16, B-3010 Leuven, Belgium
Bored with EDA the way it is? Check this:
http://jandecaluwe.com/Tools/MyHDL/Overview.html

Jul 18 '05 #1
0 1338

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

Similar topics

8
by: Jon Perez | last post by:
(sorry for the duplicate post, just wanted to make the subject line clearer) How do you set up pdb such that you will automatically get dropped into its prompt if an unanticipated exception...
3
by: sj | last post by:
Suppose the following are part of a long file and executed: logging.basicConfig(stream = sys.stderr, level=logging.INFO) logging.info("%d %d", 1, 2, 3) # buggy ...
5
by: Saizan | last post by:
In an event-driven application i'd like to keep the program alive regardless of any exceptions raised by the handlers, but still be able to debug them by reading the appropriate TraceBack from...
1
by: Bryan | last post by:
hi, i would like to save an exception and reraise it at a later time. something similar to this: exception = None def foo():     try:
5
by: NeBlackCat (lists) | last post by:
Hello everybody - my first post! And it may be the most monumentally stupid question ever asked, but I just can't see an answer after several hours experimenting, searching and reading. It's...
2
by: Sami | last post by:
Hello, In the Python book that I am using to learn the language it says that the traceback.print_exc() can be used to stop exception propagation and make the program keep running. Here is a...
5
by: Thomas Guettler | last post by:
Hi, How can you get the traceback of the inner exception? try: try: import does_not_exit except ImportError: raise Exception("something wrong") except:
0
by: mk | last post by:
Robert Rawlins wrote: Sure. I'm a little confused as to how I can modify that Remember, Google is your friend, here's the crux of the method without the fancy schmancy sugar coating:
3
by: Robert Rawlins | last post by:
Hi Mk, Yeah it's got me a little bemused to be honest, I've tried playing around with configuration options this morning and not been able to achieve anything that works properly. I'll keep...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.