Browse Source

Fix empty profile log files

pull/125/head
Adam Johnson 6 years ago
parent
commit
f95a9d34d6
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 6
      korman/operators/op_export.py

6
korman/operators/op_export.py

@ -137,8 +137,8 @@ class ExportOperator(bpy.types.Operator):
try: try:
self.export_active = True self.export_active = True
if self.profile_export: if self.profile_export:
profile = path.with_name("{}_cProfile".format(ageName)) profile_path = str(path.with_name("{}_cProfile".format(ageName)))
profile = cProfile.runctx("e.run()", globals(), locals(), str(profile)) profile = cProfile.runctx("e.run()", globals(), locals(), profile_path)
else: else:
e.run() e.run()
except exporter.ExportError as error: except exporter.ExportError as error:
@ -148,7 +148,7 @@ class ExportOperator(bpy.types.Operator):
if self.profile_export: if self.profile_export:
stats_out = path.with_name("{}_profile.log".format(ageName)) stats_out = path.with_name("{}_profile.log".format(ageName))
with open(str(stats_out), "w") as out: with open(str(stats_out), "w") as out:
stats = pstats.Stats(profile, stream=out) stats = pstats.Stats(profile_path, stream=out)
stats = stats.sort_stats("time", "calls") stats = stats.sort_stats("time", "calls")
stats.print_stats() stats.print_stats()
return {"FINISHED"} return {"FINISHED"}

Loading…
Cancel
Save