summaryrefslogtreecommitdiff
path: root/stub.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-08-17 16:19:46 -0400
committerLex Neva <github.com@lexneva.name>2018-08-17 16:19:46 -0400
commit0e4c3a3f1b76c1b655ec2788017335e87eff29da (patch)
tree2075fc0292038b4a2e92fc018b503805cf30fdec /stub.py
parent19bb8a5a6dbe4244a590147187949d0555eb9fbc (diff)
parentece81d0c91c8b96f7da2c0339f6807a47d57112e (diff)
Merge remote-tracking branch 'origin/master' into lexelby-no-embroider-command
Diffstat (limited to 'stub.py')
-rw-r--r--stub.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/stub.py b/stub.py
index 850cfe40..9c316b99 100644
--- a/stub.py
+++ b/stub.py
@@ -3,6 +3,7 @@
import sys
import os
import subprocess
+import traceback
# ink/stitch
#
@@ -30,8 +31,21 @@ 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)
+
+if sys.platform == "win32":
+ import msvcrt
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
stdout = stdout.strip()
if stdout: