Page MenuHomePhabricator

impossible to run solve_disambiguation.py on redirects
Closed, ResolvedPublic

Description

Author: hercule.wikipedia

Description:
Since yesterday I can't run solve_disambiguation.py with -redir option.
The command line is :

python solve_disambiguation.py -redir Agence France Presse

The error stack is :

Traceback (most recent call last):

File "solve_disambiguation.py", line 1147, in <module>
  main()
File "solve_disambiguation.py", line 1142, in main
  bot.run()
File "solve_disambiguation.py", line 1018, in run
  if not self.findAlternatives(disambPage):
File "solve_disambiguation.py", line 897, in findAlternatives
  target = disambPage.getRedirectTarget().title()
File "/data/project/herculebot/pywikibot-compat/wikipedia.py", line 3120, in getRedirectTarget
  target = err[0].replace('&amp;quot;', '"')

AttributeError: 'IsRedirectPage' object has no attribute 'replace'

version.Py output is :
Pywikibot: [https] r/pywikibot/compat (r10559, 341ed66, 2013/12/01, 19:41:39, OUTDATED)
Release version: 1.0b1
Python: 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3]
config-settings:
use_api = True
use_api_login = True
unicode test: ok


Version: compat-(1.0)
Severity: major

Details

Reference
bz57879

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:39 AM
bzimport set Reference to bz57879.
bzimport added a subscriber: Unknown Object (????).

-redir is not a valid option of the actual framework. Could you explain.

hercule.wikipedia wrote:

-redir is an option to indicate that the script run from a redirect.

See the documentation :
http://www.mediawiki.org/wiki/Manual:Pywikibot/solve_disambiguation.py

Change 98813 had a related patch set uploaded by Xqt:
(bug 57879): raise the right form for isRedirectPage exception

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

hercule.wikipedia wrote:

I discover that this parameter is inactive since 8 years...

https://git.wikimedia.org/commitdiff/pywikibot%2Fcompat.git/0e153e659cf6f6b7e5770b142719b818f3fe9b1e

So the correct description of the bug is that launching solve_disambiguation.py from a redirect crashes. Few days ago there was no problem

Change 98814 had a related patch set uploaded by Ladsgroup:
Fast fixation of the Bug: 57879

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

Change 98814 merged by jenkins-bot:
Fast fixation of the Bug: 57879

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

can you update your codes and run it again?

Change 98818 had a related patch set uploaded by Xqt:
Revert "Fast fixation of the Bug: 57879"

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

Change 98818 merged by Xqt:
Revert "Fast fixation of the Bug: 57879"

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

sorry for this issue. I just wanted to help :(

Change 98813 merged by jenkins-bot:
(bug 57879): raise the right form for isRedirectPage exception

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

Just a note on this for future reference.

  • Page._redirarg can be either str or IsRedirectError(str, ), depending on where it is set
  • If Page._redirarg is set, it is used to re-throw the error when page.get() (et al.) are called a second time.

The old syntax

throw IsRedirectError, e

will throw IsRedirectError(e) if e is str, or IsRedirectError(e.msg) if e is Exception.

The new syntax

throw IsRedirectError(e)

will *always* throw IsRedirectError(e), which will therefore result in IsRedirectError(IsRedirectError(page title)) if e is Exception.

Change 104344 had a related patch set uploaded by Xqt:
notice for bug 57879

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

Change 104344 merged by jenkins-bot:
notice for bug 57879

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