From 89e5e5c9dbc036be1e0c2802e2324216c6a9ff0a Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 3 Aug 2018 22:39:52 -0400 Subject: stub should also open stdout in binary mode --- stub.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'stub.py') 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(), -- cgit v1.2.3 From ab4b09531d71ff5f689cb53db9565a59a1163333 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 5 Aug 2018 23:06:24 -0400 Subject: useful error message from stub.py --- stub.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'stub.py') diff --git a/stub.py b/stub.py index 850cfe40..dae2a28f 100644 --- a/stub.py +++ b/stub.py @@ -3,6 +3,7 @@ import sys import os import subprocess +import traceback # ink/stitch # @@ -30,8 +31,17 @@ args[0] = binary_path # os.execve works here for Linux, but only this seems to get the # extension output to Inkscape on Windows -extension = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) -stdout, stderr = extension.communicate() +try: + extension = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = extension.communicate() +except: + print >> sys.stderr, "Unexpected error launching Ink/Stitch." + print >> sys.stderr, "If you're having trouble, please file an issue here, including the text below: https://github.com/inkstitch/inkstitch/issues\n" + print >> sys.stderr, "Tried to launch:", binary_path + print >> sys.stderr, "Arguments:", args + print >> sys.stderr, "Debugging information:\n" + print >> sys.stderr, traceback.format_exc() + sys.exit(1) stdout = stdout.strip() if stdout: -- cgit v1.2.3