| Dalba added a comment. |
For me, the current patch also fails on redirecting output when win-unicode-console is installed:
G:\PATH>pywikibot-core\pwb.py listpages -lang:cs -cat:Obce_v_departementu_Essonne > out.txt C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\site-packages\win_unicode_console\__init__.py:31: RuntimeWarning: sys.stdin.encoding == 'utf-8', whereas sys.stdout.encoding == 'cp1252', readline hook consumer may assume they are the same readline_hook.enable(use_pyreadline=use_pyreadline) Cannot find buffer interface for stdout, stderr or stdin. Using (incorrect) text interfaces instead. This is likely to break on non-ascii text. <Unicode redirected stdout>.write: TypeError('write() argument must be str, not bytes',) Traceback (most recent call last): File "G:\PATH\pywikibot-core\pwb.py", line 255, in <module> if not main(): File "G:\PATH\pywikibot-core\pwb.py", line 249, in main run_python_file(filename, [filename] + args, argvu, file_package) File "G:\PATH\pywikibot-core\pwb.py", line 121, in run_python_file main_mod.__dict__) File "G:\PATH\pywikibot-core\scripts\listpages.py", line 282, in <module> main() File "G:\PATH\pywikibot-core\scripts\listpages.py", line 260, in main pywikibot.stdout(output_list[-1]) File "G:\PATH\pywikibot-core\pywikibot\logging.py", line 146, in stdout logoutput(text, decoder, newline, STDOUT, **kwargs) File "G:\PATH\pywikibot-core\pywikibot\logging.py", line 107, in logoutput logger.log(_level, text, extra=context, **kwargs) File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1345, in log self._log(level, msg, args, **kwargs) File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1415, in _log self.handle(record) File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1425, in handle self.callHandlers(record) File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 1487, in callHandlers hdlr.handle(record) File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python35\lib\logging\__init__.py", line 855, in handle self.emit(record) File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 526, in emit return self.UI.output(text, targetStream=self.stream) File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 245, in output self._print(text, targetStream) File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 184, in _print self._write(text, target_stream) File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\terminal_interface_base.py", line 146, in _write target_stream.write(text) File "G:\PATH\pywikibot-core\pywikibot\userinterfaces\win32_unicode.py", line 150, in write self._stream.write(text) TypeError: write() argument must be str, not bytes CRITICAL: Closing network session.
Therefore I guess that it also won't work on Python 3.6 where PEP 528 is accepted and implements essentially the same modifications as win_unicode_console.
I've uploaded a new patch. To summarize:
win_unicode_console patch result disabled old* TypeError:write() argument must be str, not bytes disabled current* OK enabled old TypeError: write() argument must be str, not bytes enabled current TypeError: write() argument must be str, not bytes disabled new* OK enabled new OK
- old: before cc2cb51c1c94bb2d080b6ba28a520ea7442eb656
- current: after cc2cb51c1c94bb2d080b6ba28a520ea7442eb656
- new: The new patch that I've uploaded.
TASK DETAIL
EMAIL PREFERENCES
To: valhallasw, Dalba
Cc: Dalba, David.Mirth, gerritbot, valhallasw, Xqt, Aklapper, pywikibot-bugs-list, Wesalius, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, jayvdb, Alchimista, Rxy
Cc: Dalba, David.Mirth, gerritbot, valhallasw, Xqt, Aklapper, pywikibot-bugs-list, Wesalius, MayS, Lewizho99, Mdupont, JJMC89, Maathavan, jayvdb, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
