Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.7 compatibility #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions sixel/__init__.py
Expand Up @@ -54,10 +54,23 @@ def _filenize(f):

mode = os.fstat(f.fileno()).st_mode
if stat.S_ISFIFO(mode) or os.isatty(f.fileno()):
have_stringio = False
try:
from cStringIO import StringIO
have_stringio = True
except ImportError:
pass
try:
from StringIO import StringIO
have_stringio = True
except ImportError:
pass
try:
from io import StringIO
have_stringio = True
except ImportError:
pass
assert have_stringio and "no StringIO package available"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be cleaner to have the error string after a comma instead of abusing boolean operators...

return StringIO(f.read())
return f

Expand Down
51 changes: 30 additions & 21 deletions sixel/sixel_cimpl.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.