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

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@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

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

@task
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! 馃槃

Cheers
Fotis

@fgimian

This comment has been minimized.

fgimian commented Jul 28, 2015

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

@bitprophet bitprophet referenced this pull request May 26, 2016

Closed

Catchall 'encoding needs to get un-crap-ified' ticket #350

10 of 11 tasks complete
@bitprophet

This comment has been minimized.

Member

bitprophet commented Jun 3, 2016

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