Page MenuHomePhabricator

Pywikibot gives script termination on page delete
Closed, ResolvedPublic

Description

I am helping out a friend who has an SEO/legal issue on his wiki requiring mass deletion of content and pages. He were ordered to delete the pages or run the risk of being shut down.

Therefore, I am trying to use pywikibot to accomplish this.

I am able to connect to the wikisite http://unatratnag.wikia.com as my bot account "UnaBot"

I am attempting to delete page "Test_page_3"

When I try to run a delete page, it throws an exception. I spoke with some users on the IRC channel and they recommended submitting a bug.

The following is the command i executed and the results:

c:\core>delete.py -page:"Test_page_3" -always
Enter a reason for the deletion: Testing pywikibot

0 pages read
0 pages written
Execution time: 0 seconds
Script terminated by exception:

ERROR: ValueError: too many values to unpack (expected 2)
Traceback (most recent call last):

File "C:\core\delete.py", line 168, in <module>
  main()
File "C:\core\delete.py", line 160, in main
  bot.run()
File "C:\core\pywikibot\bot.py", line 1599, in run
  super(MultipleSitesBot, self).run()
File "C:\core\pywikibot\bot.py", line 1413, in run
  self.treat(page)
File "C:\core\pywikibot\bot.py", line 1626, in treat
  self.current_page = page
File "C:\core\pywikibot\bot.py", line 1213, in current_page
  page.title()))
File "C:\core\pywikibot\tools\formatter.py", line 170, in color_format
  return _ColorFormatter().format(text, *args, **kwargs)
File "C:\Users\Unatratnag\AppData\Local\Programs\Python\Python35-32\lib\string.py", line 187, in format
  return self.vformat(format_string, args, kwargs)
File "C:\core\pywikibot\tools\formatter.py", line 152, in vformat
  kwargs)
File "C:\Users\Unatratnag\AppData\Local\Programs\Python\Python35-32\lib\string.py", line 191, in vformat
  result, _ = self._vformat(format_string, args, kwargs, used_args, 2)
File "C:\core\pywikibot\tools\formatter.py", line 125, in _vformat
  result = super(_ColorFormatter, self)._vformat(*args, **kwargs)
File "C:\Users\Unatratnag\AppData\Local\Programs\Python\Python35-32\lib\string.py", line 241, in _vformat
  auto_arg_index=auto_arg_index)

ValueError: too many values to unpack (expected 2)
<class 'ValueError'>
CRITICAL: Closing network session.

Details

Related Gerrit Patches:

Event Timeline

Unatratnag raised the priority of this task from to Needs Triage.
Unatratnag updated the task description. (Show Details)
Unatratnag added a project: MediaWiki-General.
Unatratnag added a subscriber: Unatratnag.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 16 2015, 7:30 PM
valhallasw set Security to None.
Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald TranscriptDec 16 2015, 7:56 PM
XZise claimed this task.Dec 16 2015, 8:04 PM
XZise added a subscriber: XZise.

It seems that at some point in Python 3.5, Formatter._vformat changed what it returned and we had to override it so this is broken. Now I have 3.5 installed locally and there _vformat returns only one value but the current version on CPython's repository returns two and unpacks them.

Change 259549 had a related patch set uploaded (by XZise):
[FIX] Support changed _vformat signature of 3.5.1

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

Change 259549 merged by jenkins-bot:
[FIX] Support changed _vformat signature of 3.5.1

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

Xqt closed this task as Resolved.Apr 6 2016, 11:48 AM