views:

20

answers:

2

I am using the following line of code in IDLE to print out my traceback in an eception:

traceback.print_exc()

For some reason I get the red text error message, but then it is followed by a blue text of "None".

Not sure what that None is about, any ideas?

+1  A: 

print_exc() doesn't return anything, which in Python is actually returning None. Looks like IDLE is showing you the None it returned.

Ned Batchelder
ok.. so I was running the funtcion and printing it, I now have stopped printing it and it works well... thanks for the clarification
GuidoS
A: 

print_exc() prints formatted exception to stdout. If you need string value, call format_exc()

Alex Lebedev