Page MenuHomePhabricator

fixing_redirects.py crashes on [[../]]
Closed, ResolvedPublic

Description

E:\py>fixing_redirects.py -start:! -family:wikiversity

Acer Aspire One <<<

Getting 6 pages from wikiversity:cs...
Sleeping for 4.6 seconds, 2013-12-08 21:47:35

Acer Aspire One/Kychot <<<

Getting 13 pages from wikiversity:cs...
Sleeping for 5.8 seconds, 2013-12-08 21:47:43
Bad title value '../'
Traceback (most recent call last):

File "E:\py\fixing_redirects.py", line 231, in <module>
  main()
File "E:\py\fixing_redirects.py", line 225, in main
  workon(page)
File "E:\py\fixing_redirects.py", line 176, in workon
  target = page2.getMovedTarget()
File "E:\py\wikipedia.py", line 3126, in getMovedTarget
  lastmove = gen.next()['move']
File "E:\py\wikipedia.py", line 7813, in logpages
  raise BadTitle

pywikibot.exceptions.BadTitle


Version: compat-(1.0)
Severity: major

Details

Reference
bz58188

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:32 AM
bzimport set Reference to bz58188.
bzimport added a subscriber: Unknown Object (????).

another crash (unknown reason):

Biofyzika: Úvod <<<

Getting 11 pages from wikiversity:cs...
Traceback (most recent call last):

File "E:\py\fixing_redirects.py", line 231, in <module>
  main()
File "E:\py\fixing_redirects.py", line 225, in main
  workon(page)
File "E:\py\fixing_redirects.py", line 179, in workon
  target = pywikibot.Page(mysite, lastmove['new_title'])

NameError: global name 'lastmove' is not defined

E:\py>

Change 100391 had a related patch set uploaded by Xqt:
(bug 58188) global name 'lastmove' is not defined but obsolete

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

I fixed the second failure in gerrit:100391

Indeed "../" is a relative path and not a valid page title. We may keep this bug open for further enhencements to enable relative paths.

Change 100391 merged by jenkins-bot:
(bug 58188) global name 'lastmove' is not defined but obsolete

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

Can you check that again and confirm that the problem got solved?

It is not solved for a relative path like "../" because it is not a valid title and pywikibot cannot solve it (yet). Maybe it's an enhancement.

For the secound cause it works fine. But with crashes on [[../]] is this script still less usefull. What about hack - ignoring this titles until there is any better patch?

Just ignoring pages with bad titles instead of raising the exception would be possible.

Change 101899 had a related patch set uploaded by Xqt:
(bug 58188) Ignore BadTitle Error

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

JAn, could you try my last patch in gerrit 101899?

It took me several minutes to find right link to diff (damned git, why is diff hidden under small (gitblit) link and not under big M fixing_redirects.py +1, -1 *Side-by-Side* ?) and few seconds to modify my local file.

It seems good, bot skips ../ and no more crashes.

Change 101899 merged by jenkins-bot:
(bug 58188) Ignore BadTitle Error

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