diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-03-04 18:40:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 18:40:53 +0100 |
| commit | e84a86d4ac0caf29d6074728376ff0a594243fec (patch) | |
| tree | 888c79ed0094ba2916a1d329861a85515959913c /lib/utils/io.py | |
| parent | b39575a50191307b3b56eab6455626398eec6397 (diff) | |
Update for Inkscape 1.0 (#880)
* update for inkscape 1.0
* add about extension
* Build improvements for the inkscape1.0 branch (#985)
* zip: export real svg not stitch plan
* #411 and #726
* Tools for Font Creators (#1018)
* ignore very small holes in fills
* remove embroider (#1026)
* auto_fill: ignore shrink_or_grow if result is empty (#589)
* break apart: do not ignore small fills
Co-authored-by: Hagen Fritsch <rumpeltux-github@irgendwo.org>
Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'lib/utils/io.py')
| -rw-r--r-- | lib/utils/io.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/utils/io.py b/lib/utils/io.py index f51f629c..239585f4 100644 --- a/lib/utils/io.py +++ b/lib/utils/io.py @@ -1,15 +1,15 @@ import os import sys -from cStringIO import StringIO +from io 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()) - sys.real_stderr = os.fdopen(sys.stderr_dup, 'w') - os.dup2(null.fileno(), 2) - sys.stderr = StringIO() + with open(os.devnull, 'w') as null: + sys.stderr_dup = os.dup(sys.stderr.fileno()) + sys.real_stderr = os.fdopen(sys.stderr_dup, 'w', encoding='utf-8') + os.dup2(null.fileno(), 2) + sys.stderr = StringIO() def restore_stderr(): @@ -22,11 +22,11 @@ def restore_stderr(): def save_stdout(): - null = open(os.devnull, 'w') - sys.stdout_dup = os.dup(sys.stdout.fileno()) - sys.real_stdout = os.fdopen(sys.stdout_dup, 'w') - os.dup2(null.fileno(), 1) - sys.stdout = StringIO() + with open(os.devnull, 'w') as null: + sys.stdout_dup = os.dup(sys.stdout.fileno()) + sys.real_stdout = os.fdopen(sys.stdout_dup, 'w') + os.dup2(null.fileno(), 1) + sys.stdout = StringIO() def restore_stdout(): |
