From be2d6f5eeda0b2cd463e20ed559f03c71d100e26 Mon Sep 17 00:00:00 2001 From: TigerKat Date: Tue, 16 Jul 2019 19:55:41 +0930 Subject: [PATCH] bugfix: Will no longer overwrite the output when export crashes. --- geo_edit.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/geo_edit.py b/geo_edit.py index 26143de..b51a07d 100755 --- a/geo_edit.py +++ b/geo_edit.py @@ -18,8 +18,9 @@ if len(sys.argv) < 4: fn_in = sys.argv[1] fn_out = sys.argv[2] -if fn_in == fn_out: - print("Input and output filenames are identical. Refusing to run, to avoid accidental lose.") +#if fn_in == fn_out: +# print("Input and output filenames are identical. Refusing to run, to avoid accidental lose.") +# exit() print("Reading '%s'..." % (fn_in, )) fh_in = open(fn_in, "rb") @@ -68,7 +69,8 @@ while arg_i < len(sys.argv): print() print("Writing '%s'..." % (fn_out, )) +data = geo.saveToData() fh_out = open(fn_out, "wb") -geo.saveToFile(fh_out) +fh_out.write(data) fh_out.close() print("Done.")