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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worked around a Python 2.6 bug whereby file streams don't respect encoding #262

wants to merge 1 commit into from

Worked around a Python 2.6 bug whereby file streams don't respect encoding #262

wants to merge 1 commit into from


Copy link

@fgimian fgimian commented Jul 23, 2015

Hello again 馃槃

After many hours of trying to find the best way to solve this problem, here's my solution. It ensures that Python 2.6 file streams will always encode to bytes before writing to the output stream. This works around Python issue 4947.

You may reproduce the original problem as follows with Python 2.6:

# encoding: utf-8
from invoke import task, run

def output_strange_stuff():
    print '鈹斺攢鈹'

def breakit():
    run('invoke output_strange_stuff', encoding='utf-8')

Then run:

invoke breakit

Feel free to ask any questions and thanks for the amazing tool! 馃槃


Copy link

fgimian commented Jul 28, 2015

Oh dear, I broken Python 3.x compatibility. I'll look into a better way, bear with me. 馃槃

Copy link

This should be obviated by changes in #350 now. Please comment after the 0.13 release comes out if that doesn't fix things for you. Thanks!

@bitprophet bitprophet closed this Jun 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants