From 5cc2c9c7e15a7020018b7e221ef27fc3381b7345 Mon Sep 17 00:00:00 2001 From: Thom de Jong Date: Thu, 13 Nov 2025 13:22:52 +0100 Subject: [PATCH] Fix editor_result check --- src/Mod/CAM/Path/Post/UtilsExport.py | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Mod/CAM/Path/Post/UtilsExport.py b/src/Mod/CAM/Path/Post/UtilsExport.py index 4942486a3f..c00cbd3592 100644 --- a/src/Mod/CAM/Path/Post/UtilsExport.py +++ b/src/Mod/CAM/Path/Post/UtilsExport.py @@ -363,23 +363,23 @@ def export_common(values: Values, objectslist, filename: str) -> str: print("done postprocessing.") - if editor_result in [0, 1]: - if not filename == "-": - if final[0:2] == "\n\n": - # write out the gcode using "\n" as the end-of-line characters - with open(filename, "w", encoding="utf-8", newline="") as gfile: - gfile.write(final[2:]) - elif "\r" in final: - with open(filename, "w", encoding="utf-8", newline="") as gfile: - # write out the gcode with whatever end-of-line characters it already has, - # presumably either "\r" or "\r\n" - gfile.write(final) - else: - with open(filename, "w", encoding="utf-8", newline=None) as gfile: - # The gcode has "\n" as the end-of-line characters, which means - # "write out the gcode with whatever end-of-line characters the system - # that is running the postprocessor uses". - gfile.write(final) - return final - else: + if editor_result == 0: return None + + if not filename == "-": + if final[0:2] == "\n\n": + # write out the gcode using "\n" as the end-of-line characters + with open(filename, "w", encoding="utf-8", newline="") as gfile: + gfile.write(final[2:]) + elif "\r" in final: + with open(filename, "w", encoding="utf-8", newline="") as gfile: + # write out the gcode with whatever end-of-line characters it already has, + # presumably either "\r" or "\r\n" + gfile.write(final) + else: + with open(filename, "w", encoding="utf-8", newline=None) as gfile: + # The gcode has "\n" as the end-of-line characters, which means + # "write out the gcode with whatever end-of-line characters the system + # that is running the postprocessor uses". + gfile.write(final) + return final