@ -171,7 +171,7 @@ class WinUnicodeOutputBase(object):
try :
try :
for line in lines :
for line in lines :
self . write ( line )
self . write ( line )
except Exception , e :
except Exception as e :
complain ( ' %s .writelines: %r ' % ( self . name , e ) )
complain ( ' %s .writelines: %r ' % ( self . name , e ) )
raise
raise
@ -230,7 +230,7 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase):
if not remaining :
if not remaining :
break
break
text = text [ int ( n . value ) : ]
text = text [ int ( n . value ) : ]
except Exception , e :
except Exception as e :
complain ( ' %s .write: %r ' % ( self . name , e ) )
complain ( ' %s .write: %r ' % ( self . name , e ) )
raise
raise
@ -253,7 +253,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase):
def flush ( self ) :
def flush ( self ) :
try :
try :
self . _stream . flush ( )
self . _stream . flush ( )
except Exception , e :
except Exception as e :
complain ( ' %s .flush: %r from %r ' % ( self . name , e , self . _stream ) )
complain ( ' %s .flush: %r from %r ' % ( self . name , e , self . _stream ) )
raise
raise
@ -263,7 +263,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase):
# Replace characters that cannot be printed instead of failing.
# Replace characters that cannot be printed instead of failing.
text = text . encode ( self . encoding , ' replace ' )
text = text . encode ( self . encoding , ' replace ' )
self . _stream . write ( text )
self . _stream . write ( text )
except Exception , e :
except Exception as e :
complain ( ' %s .write: %r ' % ( self . name , e ) )
complain ( ' %s .write: %r ' % ( self . name , e ) )
raise
raise
@ -348,7 +348,7 @@ def fix_win_console(encoding):
# TODO(maruel): Do sys.stdin with ReadConsoleW(). Albeit the limitation is
# TODO(maruel): Do sys.stdin with ReadConsoleW(). Albeit the limitation is
# "It doesn't appear to be possible to read Unicode characters in UTF-8
# "It doesn't appear to be possible to read Unicode characters in UTF-8
# mode" and this appears to be a limitation of cmd.exe.
# mode" and this appears to be a limitation of cmd.exe.
except Exception , e :
except Exception as e :
complain ( ' exception %r while fixing up sys.stdout and sys.stderr ' % e )
complain ( ' exception %r while fixing up sys.stdout and sys.stderr ' % e )
return True
return True