Skip to content

Makes rest2html work in both Python2 and Python3#919

Merged
kivikakk merged 2 commits intogithub:masterfrom
brodock:python3-fix
Mar 16, 2017
Merged

Makes rest2html work in both Python2 and Python3#919
kivikakk merged 2 commits intogithub:masterfrom
brodock:python3-fix

Conversation

@brodock
Copy link
Copy Markdown
Contributor

@brodock brodock commented Aug 24, 2016

This is a step further supporting Python3 environments. For anyone trying to run this with Python3, you still need to either change the hardcoded python2 to python3 in command definition in markups.rb or symlink your env python2 to point to python3.

Ideally this should also be made configurable.

@brodock
Copy link
Copy Markdown
Contributor Author

brodock commented Aug 24, 2016

I'm not signing a CLA, as the only file I've changed is under http://creativecommons.org/publicdomain/zero/1.0/ which I here agree to license the submitted changes with.

input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
text = input_stream.read()
else: # python 2
text = sys.stdin.read()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

note that i've submitted that one to the python-future website to see what the best idiom would be according to them: PythonCharmers/python-future#241

This code will keep current behavior for python 2.x.
@kivikakk
Copy link
Copy Markdown
Contributor

@brodock I checked with legal just to be sure, and this is all good sans CLA under CC0. Thanks for the PR! 🙇‍♀️

@kivikakk kivikakk merged commit 3e26470 into github:master Mar 16, 2017
brasic pushed a commit that referenced this pull request Mar 30, 2021
#919 added support for python3, but
we still explicitly shell out to the `python2` executable.  Let's switch
to python3 now that it's supported.

This bumps the major version because it's a breaking change for anyone
running in an environment with only python2.
@brasic brasic mentioned this pull request Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants