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 From 05daffb7e01db55879eb24f3c00532324a5d41af Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 1 May 2018 21:21:07 -0400 Subject: refactor everything out of lib/__init__.py --- lib/utils/io.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/utils/io.py') diff --git a/lib/utils/io.py b/lib/utils/io.py index e87b9881..be1fdf24 100644 --- a/lib/utils/io.py +++ b/lib/utils/io.py @@ -2,6 +2,7 @@ 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') -- cgit v1.2.3