Debug python code

Written by admin on July 31, 2015 Categories: Dev Tags: , ,

Level 1

f = open('/tmp/debug','a')
f.write(variable + '\n')
f.close()

Level 2

from pprint import pprint
pprint(variable.__class__.__name__, f)
pprint(dir(variable), f)
pprint(vars(variable), f)

Level 3 (sur une exception)

import traceback
f.write(str(traceback.format_exc()))

 

No Comments on Debug python code

Leave a Reply

Your email address will not be published. Required fields are marked *