Skip to content

Commit

Permalink
Feat: try except for importing sys.stdout.buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
ldevillez committed Oct 6, 2023
1 parent da7a104 commit 2e9fbda
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion svg2tikz/tikz_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
from inkex.transforms import Vector2d
from lxml import etree

try:
SYS_OUTPUT_BUFFER = sys.stdout.buffer
except AttributeError:
logging.warning("Sys has no output buffer, redirecting to None")
SYS_OUTPUT_BUFFER = None

#### Utility functions and classes

TIKZ_BASE_COLOR = [
Expand Down Expand Up @@ -1337,7 +1343,7 @@ def save_raw(self, _):

self.options.output.write(out)

def run(self, args=None, output=sys.stdout.buffer):
def run(self, args=None, output=SYS_OUTPUT_BUFFER):
"""
Custom inkscape entry point to remove agr processing
"""
Expand Down

0 comments on commit 2e9fbda

Please sign in to comment.