summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/extensions/output.py7
-rw-r--r--stub.py4
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/extensions/output.py b/lib/extensions/output.py
index 1dc8d19d..f3bb0a80 100644
--- a/lib/extensions/output.py
+++ b/lib/extensions/output.py
@@ -36,10 +36,15 @@ class Output(InkstitchExtension):
write_embroidery_file(temp_file.name, stitch_plan, self.document.getroot())
+ if sys.platform == "win32":
+ import msvcrt
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
# inkscape will read the file contents from stdout and copy
# to the destination file that the user chose
- with open(temp_file.name) as output_file:
+ with open(temp_file.name, "rb") as output_file:
sys.stdout.write(output_file.read())
+ sys.stdout.flush()
# clean up the temp file
os.remove(temp_file.name)
diff --git a/stub.py b/stub.py
index 850cfe40..6cd980cb 100644
--- a/stub.py
+++ b/stub.py
@@ -33,6 +33,10 @@ args[0] = binary_path
extension = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = extension.communicate()
+if sys.platform == "win32":
+ import msvcrt
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
stdout = stdout.strip()
if stdout:
print stdout.strip(),