Commit e6e487cc authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Romain Bignon

pastoob: Don't crash if sys.stdout.encoding is None

parent 2583919b
......@@ -62,7 +62,7 @@ class Pastoob(ReplApplication):
if not paste:
print >>sys.stderr, 'Unable to handle paste: %s' % _id
return 1
output = codecs.getwriter(sys.stdout.encoding)(sys.stdout)
output = codecs.getwriter(sys.stdout.encoding or locale.getpreferredencoding())(sys.stdout)
output.write(paste.contents)
# add a newline unless we are writing
# in a file or in a pipe
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment