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