Page MenuHomePhabricator

replace.py: AttributeError: 'ReplaceRobot' object has no attribute '_sites'
Closed, ResolvedPublic

Description

This morning I've updated my local copy of the repository. Was about to do some maintenance replacements and got greeted with this error:

$> python pwb.py replace.py -family:AAAAAAA -filelinks:"AAAAAAA.png" "BBBBB" "CCCCC"
Traceback (most recent call last):

File "pwb.py", line 181, in <module>
  run_python_file(fn, argv, argvu)
File "pwb.py", line 75, in run_python_file
  exec(compile(source, filename, "exec"), main_mod.__dict__)
File "scripts/replace.py", line 730, in <module>
  main()
File "scripts/replace.py", line 719, in main
  allowoverlap, recursive, add_cat, sleep, edit_summary)
File "scripts/replace.py", line 289, in __init__
  self.site = site
File ".../pywikibot/core/pywikibot/bot.py", line 1073, in site
  if site not in self._sites:

AttributeError: 'ReplaceRobot' object has no attribute '_sites'
<type 'exceptions.AttributeError'>

Since I had other tasks to do, this one wasn't urgent, I left the problem. Now I've updated the repo again to see if it has been somehow fixed, but it isn't :(

There seems to be no way to run replace.py now without this error :(

Current version is f8ad9fcd1ca2a5bba830be55cf05f475f9dbdfeb


Version: core-(2.0)
Severity: critical

Details

Reference
bz73494

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:47 AM
bzimport set Reference to bz73494.

This bug was probably introduced in https://gerrit.wikimedia.org/r/166583/ and is due to the fact that ReplaceRobot.init is not calling Bot.init.

Change 173674 had a related patch set uploaded by John Vandenberg:
Add superclass initialisation for three Bot scripts

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

Change 173674 merged by jenkins-bot:
Add superclass initialisation for three Bot scripts

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

Now the error is a bit further:

Traceback (most recent call last):

File "pwb.py", line 181, in <module>
  run_python_file(fn, argv, argvu)
File "pwb.py", line 75, in run_python_file
  exec(compile(source, filename, "exec"), main_mod.__dict__)
File "scripts/replace.py", line 731, in <module>
  main()
File "scripts/replace.py", line 720, in main
  allowoverlap, recursive, add_cat, sleep, edit_summary)
File "scripts/replace.py", line 290, in __init__
  self.site = site
File ".../pywikibot/core/pywikibot/bot.py", line 1075, in site
  % (site, unicode(site.version())))

AttributeError: 'NoneType' object has no attribute 'version'
<type 'exceptions.AttributeError'>

Change 173675 had a related patch set uploaded by John Vandenberg:
Bot.site property fails when set to None

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

Change 173675 merged by jenkins-bot:
Bot.site property fails when set to None

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