From 1b31806423c8fec4040fed6d1009db016860b763 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 1 May 2018 20:37:51 -0400 Subject: rename inkstitch/ to lib/ You can't have a module and a package named the same thing. PyInstaller wants to import the main script as if it were a module, and this doesn't work unless there's no directory of the same name with a __init__.py in it. --- lib/utils/io.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/utils/io.py (limited to 'lib/utils/io.py') diff --git a/lib/utils/io.py b/lib/utils/io.py new file mode 100644 index 00000000..e87b9881 --- /dev/null +++ b/lib/utils/io.py @@ -0,0 +1,17 @@ +import os +import sys +from cStringIO import StringIO + +def save_stderr(): + # GTK likes to spam stderr, which inkscape will show in a dialog. + null = open(os.devnull, 'w') + sys.stderr_dup = os.dup(sys.stderr.fileno()) + os.dup2(null.fileno(), 2) + sys.stderr_backup = sys.stderr + sys.stderr = StringIO() + + +def restore_stderr(): + os.dup2(sys.stderr_dup, 2) + sys.stderr_backup.write(sys.stderr.getvalue()) + sys.stderr = sys.stderr_backup -- cgit v1.2.3