Skip to content

Instantly share code, notes, and snippets.

@scraperdragon
Last active December 1, 2015 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scraperdragon/3634011 to your computer and use it in GitHub Desktop.
Save scraperdragon/3634011 to your computer and use it in GitHub Desktop.
Let python redirect unicode stdout to files w/out crashing. Requires LANG=C.UTF-8 or similar in .profile
import codecs
import sys
sys.stdout = codecs.getwriter('utf-8')(sys.__stdout__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment