Page MenuHomePhabricator

pywikibot specialbots.py UploadRobot not working in python3
Closed, ResolvedPublic

Description

When I run the UploadRobot from specialbots.py from the pywikibot-core I get the following error:

ERROR: Upload error:
Traceback (most recent call last):

File "../..\pywikibot\specialbots.py", line 407, in upload_file
  temp = self.read_file_content(file_url)
File "../..\pywikibot\specialbots.py", line 150, in read_file_content
  content_len = infile.info().getheader('Content-Length')

AttributeError: 'HTTPMessage' object has no attribute 'getheader'

Changing (https://github.com/wikimedia/pywikibot-core/blob/master/pywikibot/specialbots.py#L145) .getheader to .get in lines 145, 150 and 151 solves the issue.

Not sure if that breaks the functionality for python 2 or whether that creates any other issues

Details

Related Gerrit Patches:

Event Timeline

Basvb created this task.Mar 26 2017, 3:03 PM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptMar 26 2017, 3:03 PM
Xqt triaged this task as High priority.Mar 26 2017, 3:59 PM
Xqt added a subscriber: Xqt.

Looks like this issue.

Xqt claimed this task.Mar 26 2017, 4:25 PM

Change 344829 had a related patch set uploaded (by Xqt):
[pywikibot/core@master] [bugfix] Enable specialbots.py for PY3

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

Change 344829 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Enable specialbots.py for PY3

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

Xqt closed this task as Resolved.Mar 26 2017, 6:29 PM