print() 
print('Printing the full traceback as if we had not caught it here...')
print(format_exception(e))

def main3():
    raise Exception()
if __name__ == '__main__':
    main1()
How to get a complete exception stack trace in Python