pastoob: Don't crash if sys.stdout.encoding is None
This commit is contained in:
parent
e829406c78
commit
0a73b9e963
1 changed files with 1 additions and 1 deletions
|
|
@ -62,7 +62,7 @@ class Pastoob(ReplApplication):
|
||||||
if not paste:
|
if not paste:
|
||||||
print >>sys.stderr, 'Unable to handle paste: %s' % _id
|
print >>sys.stderr, 'Unable to handle paste: %s' % _id
|
||||||
return 1
|
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)
|
output.write(paste.contents)
|
||||||
# add a newline unless we are writing
|
# add a newline unless we are writing
|
||||||
# in a file or in a pipe
|
# in a file or in a pipe
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue