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.