Page MenuHomePhabricator

Invalid title error occurred in selflink.py
Closed, InvalidPublic

Description

>>> .नेट फ्रेमवर्क <<<
Traceback (most recent call last):
  File "C:\Users\jay\pywikibot\pwb.py", line 270, in <module>
    if not main():
  File "C:\Users\jay\pywikibot\pwb.py", line 264, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "C:\Users\jay\pywikibot\pwb.py", line 109, in run_python_file
    main_mod.__dict__)
  File ".\scripts\selflink.py", line 208, in <module>
    main()
  File ".\scripts\selflink.py", line 205, in main
    bot.run()
  File "C:\Users\jay\pywikibot\pywikibot\bot.py", line 1262, in run
    self.treat(page)
  File ".\scripts\selflink.py", line 156, in treat
    jumpToBeginning = self.handleNextLink(page, match)
  File ".\scripts\selflink.py", line 85, in handleNextLink
    if linkedPage != page:
  File "C:\Users\jay\pywikibot\pywikibot\tools\__init__.py", line 139, in __ne__
    return other != self._cmpkey()
  File "C:\Users\jay\pywikibot\pywikibot\page.py", line 295, in _cmpkey
    return (self.site, self.namespace(), self.title())
  File "C:\Users\jay\pywikibot\pywikibot\page.py", line 141, in site
    return self._link.site
  File "C:\Users\jay\pywikibot\pywikibot\page.py", line 4702, in site
    self.parse()
  File "C:\Users\jay\pywikibot\pywikibot\page.py", line 4656, in parse
    u"%s contains illegal char(s) %s" % (repr(t), repr(m.group(0))))
pywikibot.exceptions.InvalidTitle: '\u0939\u0948 \u0914\u0930 \u0907\u0938\u092e\u0947\u0902 ASP.NET, ADO.NET \u0914\u0930 [[Windows Forms' contains illegal char(s) '['
<class 'pywikibot.exceptions.InvalidTitle'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort

Error occurred in selflink.py. When I Worked on Hindi Wikipedia.
So I Add Some Lines on Standard selflink.py

        except pywikibot.NoPage:
            pywikibot.output(u"Page %s does not exist."
                             % page.title(asLink=True))
        except pywikibot.IsRedirectPage:
            pywikibot.output(u"Page %s is a redirect; skipping."
                             % page.title(asLink=True))
        except pywikibot.LockedPage:
            pywikibot.output(u"Page %s is locked." % page.title(asLink=True))


def main(*args):

To

        except pywikibot.NoPage:
            pywikibot.output(u"Page %s does not exist."
                             % page.title(asLink=True))
        except pywikibot.IsRedirectPage:
            pywikibot.output(u"Page %s is a redirect; skipping."
                             % page.title(asLink=True))
        except pywikibot.LockedPage:
            pywikibot.output(u"Page %s is locked." % page.title(asLink=True))
        except pywikibot.InvalidTitle:
            pywikibot.output(u"Page %s is Invalid." % page.title(asLink=True))


def main(*args):

Now Its Worked Fine. But I know this is not a Perfect Solution for It. Phabricator can makes it perfect.

Event Timeline

FTR, caused by such a 'wikilink':

[[है और इसमें ASP.NET, ADO.NET और [[Windows Forms]]]]

in hiwiki: .नेट फ्रेमवर्क

@Jayprakash12345, don't wait for perfect sollutions :) If you figured out how to fix a bug in code, consider creating a patch for it.

Jayprakash12345 claimed this task.

The Pywikibot/Compact is no more

Xqt removed Jayprakash12345 as the assignee of this task.

Don't think that this is an invalid task. This is neither a compat problem nor is it solved. I got this error on other scripts too especially in checkimages.py. Reopened then.

@Jayprakash12345: On the other hand your script is very outdated and seems more than two years old. Please update your bot first and file a new task if this bug already occurs.