Page MenuHomePhabricator

harvest_template.py uses clear() method available only in Python 3.3
Closed, ResolvedPublic

Description

harvest_template.py crashes when run on python 2.7 due to usage of python 3.3 only method:

$> python pwb.py harvest_template -lang:pl -namespace:0 -template:"Biogram infobox" -islink 'miejsce urodzenia' P19 'miejsce śmierci' P20 'data urodzenia' P569 'data śmierci' P570 -pt:15
Traceback (most recent call last):
  File "pwb.py", line 262, in <module>
    if not main():
  File "pwb.py", line 255, 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/harvest_template.py", line 386, in <module>
    main()
  File "./scripts/harvest_template.py", line 357, in main
    current_args.clear()
AttributeError: 'list' object has no attribute 'clear'
<type 'exceptions.AttributeError'>
CRITICAL: Closing network session.


$ python pwb.py version
Pywikibot: [https] r-pywikibot-core (f07e4bb, g8564, 2017/08/27, 22:45:37, n/a)
Release version: 3.0-dev
requests version: 2.6.0
  cacerts: /etc/pki/tls/certs/ca-bundle.crt
    certificate test: ok
Python: 2.7.5 (default, Aug  2 2016, 04:20:16) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

Details

Related Gerrit Patches:

Event Timeline

Masti created this task.Sep 1 2017, 1:13 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 1 2017, 1:13 PM
Dalba claimed this task.Sep 1 2017, 1:32 PM
Dalba triaged this task as High priority.
Dalba updated the task description. (Show Details)

Change 375376 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] harvest_template.py: Do not use list.clear which is python 3 only

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

Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald TranscriptSep 1 2017, 1:47 PM

Change 375376 merged by jenkins-bot:
[pywikibot/core@master] harvest_template.py: Do not use list.clear which is python 3 only

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

Dalba closed this task as Resolved.Sep 1 2017, 1:57 PM

Thanks to Strainu for reviewing it so fast.