Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7538641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:10:20+00:00 2026-05-30T07:10:20+00:00

I noticed that in Python2 when I try to dump the exception stack trace,

  • 0

I noticed that in Python2 when I try to dump the exception stack trace, but there’s no active exception, it prints None:

Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
>>> import traceback
>>> traceback.print_exc()
None

But Python3 fails with some internal problem:

Python 3.2.2 (default, Sep  5 2011, 21:17:14) 
>>> import traceback
>>> traceback.print_exc()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.2/traceback.py", line 259, in print_exc
    print_exception(etype, value, tb, limit, file, chain)
  File "/usr/lib/python3.2/traceback.py", line 155, in print_exception
    for value, tb in values:
  File "/usr/lib/python3.2/traceback.py", line 122, in _iter_chain
    cause = exc.__cause__
AttributeError: 'NoneType' object has no attribute '__cause__'

Is this a bug in Python, or should I always test for some condition before calling print_exc()

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:10:21+00:00Added an answer on May 30, 2026 at 7:10 am

    That is a bug. It might be decided that an error should be raised, but that is definitely the wrong error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make my code fool-proof, but I've noticed that it takes a
I've noticed a discrepancy in the way that python parameters are called. In every
While answering Static class variables in Python I noticed that PythonWin PyWin32 build 209.2
I noticed in the main Django introductin they show a feature that maps python
I am reading cpython code for python 3k and I have noticed, that __missing__
I noticed that you can call Queue.Synchronize to get a thread-safe queue object, but
I noticed that there is one change about ASP.NET Routing. I cannot understand why
I noticed that in Python, people initialize their class attributes in two different ways.
I noticed that the Python 2.7 documentation includes yet another command-line parsing module. In
I just noticed that my old codes written in python 2.5 does not work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.