Page MenuHomePhabricator

listpages exception on Win32 Python 3
Closed, ResolvedPublic


> listpages -format:2 -grep:"Some Regexp" -transcludes:"SomeTemplate"  >mylist.txt
<Unicode redirected stdout>.write: TypeError('must be str, not bytes',)
Traceback (most recent call last):
  File "C:\Users\...\core\", line 215, in <module>
    run_python_file(filename, argv, argvu, file_package)
  File "C:\Users\...\core\", line 84, in run_python_file
  File ".\scripts\", line 239, in <module>
  File ".\scripts\", line 222, in main
    pywikibot.stdout(page_fmt.output(num=i, fmt=fmt))
  File "C:\Users\...\core\pywikibot\", line 470, in stdout
    logoutput(text, decoder, newline, STDOUT, **kwargs)
  File "C:\Users\...\core\pywikibot\", line 435, in logoutput
    logger.log(_level, text, extra=context, **kwargs)
  File "C:\Python34\lib\logging\", line 1341, in log
    self._log(level, msg, args, **kwargs)
  File "C:\Python34\lib\logging\", line 1409, in _log
  File "C:\Python34\lib\logging\", line 1419, in handle
  File "C:\Python34\lib\logging\", line 1481, in callHandlers
  File "C:\Python34\lib\logging\", line 853, in handle
  File "C:\Users\...\core\pywikibot\userinterfaces\
", line 436, in emit
    return self.UI.output(text,
  File "C:\Users\...\core\pywikibot\userinterfaces\
", line 193, in output
    self._print(text, targetStream)
  File "C:\Users\...\core\pywikibot\userinterfaces\
", line 136, in _print
    self.printNonColorized(text, targetStream)
  File "C:\Users\...\core\pywikibot\userinterfaces\
", line 128, in printNonColorized
  File "C:\Users\...\core\pywikibot\userinterfaces\", line 19
9, in write
TypeError: must be str, not bytes

Event Timeline

jayvdb created this task.Jul 30 2015, 10:46 PM
jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb added a subscriber: jayvdb.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJul 30 2015, 10:46 PM
Ssola added a subscriber: Ssola.EditedJul 30 2015, 10:51 PM
C:\Users\...\core> version
Pywikibot: nightly/core (c224768, 2, 2015/04/13, 12:03:18, OUTDATED)
Release version: 2.0b3
httplib2 version: 0.9
  cacerts: C:\Users\...\core\externals\httplib2\python3\httplib2\cacerts.txt
    certificate test: ok
Python: 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (I
  unicode test: ok
PYWIKIBOT2_DIR_PWB: C:\Users\...\core
Config base dir: C:\Users\...\core
Usernames for family "wikipedia":
        ca: SalviBot (no sysop configured)
XZise added a subscriber: XZise.Jul 31 2015, 5:41 AM

Hmm this seems to me that forwarding is actually the problem. Can someone on Windows test version > test_output?

(BTW to the comment above me, you could wrap the output in 3 ` to make everything code)

Xqt triaged this task as High priority.Sep 23 2018, 8:38 AM
Xqt closed this task as Resolved.Jun 20 2019, 1:17 PM
Xqt claimed this task.
Xqt added a subscriber: Xqt.

Works for me