Fix bug with sys.stdout
Infer extension from path in graphing.save