Carlb added a comment.

  This is specific to Pywikibot-interwikidata.py, which requires your 'bot run 
on a "home" wiki with access to a Wikidata-style (Wikibase) repository. You 
can't do this on cs:uncyc but it should be possible on pt:uncyc (as one 
example). OK, here goes:
  
    $ wget https://tools.wmflabs.org/pywikibot/core_stable.zip
    $ unzip core_stable.zip
    $ cd core_stable
    $ python pwb.py generate_family_file
       Please insert URL to wiki: https://data.uncyclomedia.org
       Please insert a short name (eg: freeciv): uncyclopedia
       Generating family file from https://data.uncyclomedia.org
       ==================================
       API url: https://data.uncyclomedia.org/api.php
       MediaWiki version: 1.31.1
       ==================================
       Determining other languages...af ang ar ast bar be bg bn bs ca cmn cs cy 
da de dlm el en en-gb eo es et fa fi fo fr fy ga gl got grc he hr hu hy id ie 
io is it ja jv ka km ko kw la lb lfn li lo lt lv mg mk mn mo ms mwl nap nds nl 
nn no oc olb pl pt pt-br ro ru rue sco simple sk sl sr su sv th tl tlh tr uk vi 
vls xh yi yue zea zh zh-cn zh-hk zh-tw
       There are 95 languages available. Do you want to generate interwiki 
links? This might take a long time. ([y]es/[N]o/[e]dit) 
       Writing 
/var/www/hymie/test_bot/pywikibot/families/uncyclopedia_family.py... 
  
  OK, it created the family file. Now try to run the interwikidata bot:
  
    $ python pwb.py interwikidata -create -merge -start
      NOTE: 'user-config.py' was not found!  Please follow the prompts to 
create it:  You can abort at any time by pressing ctrl-c
       1: commons
       2: i18n
       3: incubator
      ...
      13: uncyclopedia
      ...
      Select family of sites we are working on, just enter the number or name 
(default: wikipedia): 13
      This is the list of known languages: af, ang, ar, ast, bar, be, bg, bn, 
bs, ca, cmn, cs, cy, da, de, dlm, el, en, en-gb, eo, es, et, fa, fi, fo, fr, 
fy, ga, gl, grc, he, hr, hu, hy, id, ie, io, is, it, ja, jv, ka, km, ko, kw, 
la, lb, lfn, li, lo, lt, lv, mg, mk, mn, mo, ms, mwl, nap, nds, nl, nn, no, oc, 
olb, pl, pt, pt-br, ro, ru, rue, sco, simple, sk, sl, sr, su, sv, th, tl, tlh, 
tr, uk, vi, vls, xh, yi, yue, zea, zh, zh-cn, zh-hk, zh-tw
      The language code of the site we're working on (default: en): pt
      Username on pt:uncyclopedia: Hymie le robot
      Do you want to add any other projects? ([y]es, [N]o): 
  
  OK, it created user-config.py ... now try to run the bot (again):
  
    $ python pwb.py interwikidata -create -merge -start
    WARNING: Site "uncyclopedia:pt" supports wikibase at 
"http://data.uncyclomedia.org//index.php";, but creation failed: Unknown URL 
'http://data.uncyclomedia.org//index.php'..
  
  Uh, oh. Maybe it doesn't like this (from pywikibot/site.py line 2814):
  
    url = data['base'] + data['scriptpath'] + '/index.php'
  
  so I shall change it to:
  
    url = data['base'] + data['scriptpath'] + 'index.php'
  
  to get rid of that //index.php with the double-slash.
  
  I try the 'bot again:
  
    $ python pwb.py interwikidata -create -merge -start
      Retrieving 50 pages from uncyclopedia:pt.
      >>> "Groovy Guy" Russell <<<
      No interlanguagelinks on [["Groovy Guy" Russell]]
      >>> "Você foi banido da Desciclopédia" na página de usuário <<<
      No interlanguagelinks on [["Você foi banido da Desciclopédia" na página 
de usuário]]
      >>> "Weird Al" Yankovic <<<
      WARNING: [getLanguageLinks] 2 or more interwiki links point to site 
uncyclopedia:da.
      WARNING: [getLanguageLinks] 2 or more interwiki links point to site 
uncyclopedia:en.
      WARNING: [getLanguageLinks] 2 or more interwiki links point to site 
uncyclopedia:it.
      WARNING: [getLanguageLinks] 2 or more interwiki links point to site 
uncyclopedia:sv.
      WARNING: [getLanguageLinks] 2 or more interwiki links point to site 
uncyclopedia:tr.
  
  and it runs for a while (at one point asking to log me into uncyclopedia:en 
for some reason), until eventually:
  
    >>> ( ͡° ͜ʖ ͡°) <<<
    No interlanguagelinks on [[( ͡° ͜ʖ ͡°)]]
    
    >>> * <<<
    13 pages read
    0 pages written
    Execution time: 110 seconds
    Read operation time: 8 seconds
    Script terminated by exception:
    ERROR: WikiBaseError: uncyclopedia:fr has no data repository
    Traceback (most recent call last):
      File "pwb.py", line 250, in <module>
        if not main():
      File "pwb.py", line 243, in main
        run_python_file(filename, [filename] + args, argvu, file_package)
      File "pwb.py", line 95, in run_python_file
        main_mod.__dict__)
      File "./scripts/interwikidata.py", line 246, in <module>
        main()
      File "./scripts/interwikidata.py", line 239, in main
        bot.run()
      File "/var/www/hymie/test_bot/pywikibot/bot.py", line 1508, in run
        self.treat(page)
      File "/var/www/hymie/test_bot/pywikibot/bot.py", line 1735, in treat
        self.treat_page()
      File "./scripts/interwikidata.py", line 96, in treat_page
        item = self.try_to_merge(item)
      File "./scripts/interwikidata.py", line 193, in try_to_merge
        wd_data = self.get_items()
      File "./scripts/interwikidata.py", line 165, in get_items
        wd_data.add(pywikibot.ItemPage.fromPage(iw_page))
      File "/var/www/hymie/test_bot/pywikibot/page.py", line 4390, in fromPage
        ''.format(page.site))
    pywikibot.exceptions.WikiBaseError: uncyclopedia:fr has no data repository
    CRITICAL: Exiting due to uncaught exception <class 
'pywikibot.exceptions.WikiBaseError'>
  
  Indeed, fr:uncyc has no Wikibase data repository (as, relative to pt:uncyc, 
it's hosted externally). That shouldn't prevent me from making outbound links 
from pt:uncyc's Wikibase repository one-way to fr: but it does. That's a bug in 
the pywikibot interwikidata.py script.

TASK DETAIL
  https://phabricator.wikimedia.org/T221556

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Carlb
Cc: Dvorapa, Ladsgroup, Xqt, Aklapper, pywikibot-bugs-list, Carlb, alaa_wmde, 
DannyS712, Nandana, Wenyi, Lahi, Gq86, GoranSMilovanovic, QZanden, Tbscho, 
MayS, LawExplorer, Mdupont, JJMC89, _jensen, rosalieper, Avicennasis, 
mys_721tx, Wikidata-bugs, aude, jayvdb, Dalba, Masti, Alchimista, Mbch331, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to