I wonder, when you already run this within PyCharm, why not just set breakpoints and use the PyCharm debugger?
For unhandled exceptions, I have also my own little package: https://github.com/albertz/py_better_exchook
I sometimes also wrap this like:
try:
# Sth which might throw whatever,
# but we could still proceed afterwards with reasonable
# fallback logic, or just skip this.
...
except Exception:
print("Warning: XY failed...")
# print stack trace, but then proceed
sys.excepthook(*sys.exc_info())