BillPull
BillPull

Reputation: 7013

Windows Python 2.5 Traceback.py Nonetype error

Hello I am running Python 2.5 on Windows and whenever my application gets an exception rather than seeing the debug information I get an error inside of the traceback.py file itself. Anyone know a fix for this mb a patch or replacement file.

Traceback (most recent call last):
  File "C:\Python25\lib\logging\__init__.py", line 744, in emit
    msg = self.format(record)
  File "C:\Python25\lib\logging\__init__.py", line 630, in format
    return fmt.format(record)
  File "C:\Python25\lib\logging\__init__.py", line 426, in format
    record.exc_text = self.formatException(record.exc_info)
  File "C:\Python25\lib\logging\__init__.py", line 398, in formatException
    traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
  File "C:\Python25\lib\traceback.py", line 126, in print_exception
    lines = format_exception_only(etype, value)
  File "C:\Python25\lib\traceback.py", line 176, in format_exception_only
    stype = etype.__name__
AttributeError: 'NoneType' object has no attribute '__name__'

===EDIT===

Found same error in mailing list here outdated answer it seems

http://mail.python.org/pipermail/python-dev/2006-September/068975.html

Upvotes: 0

Views: 206

Answers (1)

nneonneo
nneonneo

Reputation: 179592

Possible causes:

  1. Calling logging.exception() when there is no active exception
  2. Calling a logging function with exc_info=1, when there is no active exception.
  3. Calling a logging function with exc_info=(None, None, None) to a logging function (e.g. if doing the exception logging manually).

You should not use logging.exception outside of an except block.

The exception is caused by a None exception type passed to traceback.print_exception, meaning that there is no active exception to process.

Meanwhile, the newsgroup posting you linked to indicates that it was a regression in the standard library that resulted in that particular traceback. You may want to try upgrading your Python to 2.5.1, which fixed this particular problem.

Upvotes: 2

Related Questions