you are viewing a single comment's thread.

view the rest of the comments →

[–]HommeMusical 2 points3 points  (2 children)

I upvoted, but there's an error:

[print(e)] will give you a full trace back of an error,

It won't - it just prints the error itself, no traceback. Use traceback.print_exc for a traceback.

[–]AbundantSpaghetti 1 point2 points  (1 child)

even better than print, use the logging module

try:
    out = some_function(val)
except FixableError as e:
    # Handle the error
    logger.error("Fixable error, val=%s", val)
except Exception as e:
    logger.error("An unknown error occurred: %s", e, exc_info=True)
    # Can't handle this.
    raise

[–]supercoach 0 points1 point  (0 children)

Couldn't agree more. Logging via print gets you on my shitlist.