XZise added a comment.

Another problem is then, that the `std*` is a `StringIO` so only accepts 
strings but in Python 3, when we encode the colored messages in 
`pywikibot.userinterfaces.terminal_interface_unix.UnixUI.printColorized`, it's 
bytes. I'm not sure if we shouldn't encode it or if it needs to be `BytesIO`. 
But afaik `sys.__std*` are `str` based in Python 3 so I think they shouldn't be 
encoded, especially as 
`pywikibot.userinterfaces.terminal_interface_base.UI.printNonColorized` does 
that:

```
if sys.version_info[0] == 2:                                        
    line = line.encode(self.encoding, 'replace')                    
targetStream.write(line)
```

Although I'm wondering why it does work outside of the test and the logic in 
`printColorized` appears more complex so I'm currently not sure how that need 
to be changed.

TASK DETAIL
  https://phabricator.wikimedia.org/T76248

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

To: XZise
Cc: pywikipedia-bugs, valhallasw, XZise, jayvdb



_______________________________________________
Pywikipedia-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-bugs

Reply via email to