Skip to content

traceback.format_exc(err) doesn't work in python3 #84

@jhultgre

Description

@jhultgre

The calls when logging exceptions that use format_exc(err) don't work in python3

format_exc only takes a limit and chain arguments
https://docs.python.org/3/library/traceback.html?highlight=format_exc#traceback.format_exc

I'm getting errors like these

  File "Z:\tools\shotgun\shotgunEvents\shotgunEventDaemon.py", line 586, in _saveEventIdData
    traceback.format_exc(err),
  File "C:\Program Files\Python37\lib\traceback.py", line 167, in format_exc
    return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
  File "C:\Program Files\Python37\lib\traceback.py", line 121, in format_exception
    type(value), value, tb, limit=limit).format(chain=chain))
  File "C:\Program Files\Python37\lib\traceback.py", line 508, in __init__
    capture_locals=capture_locals)
  File "C:\Program Files\Python37\lib\traceback.py", line 337, in extract
    if limit >= 0:
TypeError: '>=' not supported between instances of 'FileNotFoundError' and 'int' 

python 2 doesn't seem to care about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions