Page MenuHomePhabricator

cfd assumes family wikipedia
Closed, ResolvedPublic

Description

If script cfd is run with family wikidata, it throws NoSuchSite.

Traceback (most recent call last):
  File "pwb.py", line 157, in <module>
    run_python_file(fn, argv, argvu)
  File "pwb.py", line 67, in run_python_file
    exec(compile(source, filename, "exec"), main_mod.__dict__)
  File "scripts/cfd.py", line 178, in <module>
    main()
  File "scripts/cfd.py", line 69, in main
    for line in page.get().split("\n"):
  File ".../pywikibot/__init__.py", line 432, in wrapper
    return method(*__args, **__kw)
  File ".../pywikibot/__init__.py", line 432, in wrapper
    return method(*__args, **__kw)
  File ".../pywikibot/page.py", line 315, in get
    self._getInternals(sysop)
  File ".../pywikibot/page.py", line 339, in _getInternals
    self.site.loadrevisions(self, getText=True, sysop=sysop)
  File ".../pywikibot/page.py", line 121, in site
    return self._link.site
  File ".../pywikibot/page.py", line 3750, in site
    self.parse()
  File ".../pywikibot/page.py", line 3673, in parse
    newsite = pywikibot.Site(otherlang, familyName)
  File ".../pywikibot/__init__.py", line 483, in Site
    _sites[key] = __Site(code=code, fam=fam, user=user, sysop=sysop)
  File ".../pywikibot/site.py", line 635, in __init__
    BaseSite.__init__(self, code, fam, user, sysop)
  File ".../pywikibot/site.py", line 166, in __init__
    % (self.__code, self.__family.name))
pywikibot.exceptions.NoSuchSite: Language wikidata does not exist in family wikipedia
<class 'pywikibot.exceptions.NoSuchSite'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort

Version: core-(2.0)
Severity: minor

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:28 AM
bzimport set Reference to bz69015.
bzimport added a subscriber: Unknown Object (????).

It looks like the script is supposed to work only on wikipedia.

The location of the CFD working page.

24 cfdPage = u'Wikipedia:Categories for discussion/Working'

Seems it's a single purpose bot for en-wiki.

So we should add a check in main() to exit if the config/args site is not en.wp?
Or ignore the config/args and use en.wp anyway?

I'd recommend the first, so someone doesn't accidentally execute it on en.wp, and if someone does want to use it on en.wp they could use -family: and -code: or change the user-config depending on their preference.

Change 176323 had a related patch set uploaded (by XZise):
[FIX] CFD: Only allow script to be run on enwp

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

Patch-For-Review

Change 176323 merged by jenkins-bot:
[FIX] CFD: Only allow script to be run on enwp

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

XZise claimed this task.

Ops, didn't saw it was marked for easy :/

XZise removed a project: Patch-For-Review.
XZise set Security to None.
XZise removed a subscriber: Unknown Object (????).