Page MenuHomePhabricator

piper.py fails on python3 when there are non-ascii characters in wikitext
Closed, ResolvedPublic

Description

$  python3 pwb.py piper -filter:"tr A-Z a-z" -page:"Arabic diacritics" -simulate -family:wikipedia -lang:en
Retrieving 1 pages from wikipedia:en.


>>> Arabic diacritics <<<

0 pages read
0 pages written
Execution time: 0 seconds
Script terminated by exception:

ERROR: TypeError: Template.append: cmd must be a string
Traceback (most recent call last):
  File "pwb.py", line 256, in <module>
    if not main():
  File "pwb.py", line 250, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File "./scripts/piper.py", line 159, in <module>
    main()
  File "./scripts/piper.py", line 151, in main
    bot.run()
  File "/mnt/nfs/labstore-secondary-tools-project/dbbot/.pywikibot/pywikibot/bot.py", line 1594, in run
    super(MultipleSitesBot, self).run()
  File "/mnt/nfs/labstore-secondary-tools-project/dbbot/.pywikibot/pywikibot/bot.py", line 1408, in run
    self.treat(page)
  File "/mnt/nfs/labstore-secondary-tools-project/dbbot/.pywikibot/pywikibot/bot.py", line 1695, in treat
    super(ExistingPageBot, self).treat(page)
  File "/mnt/nfs/labstore-secondary-tools-project/dbbot/.pywikibot/pywikibot/bot.py", line 1759, in treat
    super(NoRedirectPageBot, self).treat(page)
  File "/mnt/nfs/labstore-secondary-tools-project/dbbot/.pywikibot/pywikibot/bot.py", line 1622, in treat
    self.treat_page()
  File "./scripts/piper.py", line 113, in treat_page
    text = self.pipe(program, text)
  File "./scripts/piper.py", line 91, in pipe
    pipe.append(program.encode('ascii'), '--')
  File "/mnt/nfs/labstore-secondary-tools-project/dbbot/.python/360/lib/python3.6/pipes.py", line 113, in append
    raise TypeError('Template.append: cmd must be a string')
TypeError: Template.append: cmd must be a string
<class 'TypeError'>
CRITICAL: Closing network session.

Details

Related Gerrit Patches:

Event Timeline

Dalba created this task.Feb 5 2017, 11:30 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptFeb 5 2017, 11:30 AM

Change 337224 had a related patch set uploaded (by Mpaa):
piper.py: fix bytes/str handling in python3

https://gerrit.wikimedia.org/r/337224

Change 337224 merged by Xqt:
[pywikibot/core@master] piper.py: fix bytes/str handling in python3

https://gerrit.wikimedia.org/r/337224

Mpaa closed this task as Resolved.Jun 19 2017, 7:58 PM
Mpaa claimed this task.