Page MenuHomePhabricator

replace.py fails with RuntimeError within threading
Open, MediumPublic

Description

C:\pwb\GIT\core>py -3 pwb.py replace -fix:source -lang:als
Retrieving 36 pages from wikipedia:als.
No changes were necessary in [[Arduino-Plattform]]
...
No changes were necessary in [[Hilfe:Signatur]]
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 5 seconds before retrying.
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 10 seconds before retrying.
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 20 seconds before retrying.
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 40 seconds before retrying.
Exception in thread Put-Thread:
Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1406, in async_manager
    request(*args, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\page\__init__.py", line 117, in handle
    func(self, *args, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\page\__init__.py", line 1313, in _save
    summary = self._cosmetic_changes_hook(summary)
  File "C:\pwb\GIT\core\pywikibot\page\__init__.py", line 1359, in _cosmetic_changes_hook
    self.text = cc_toolkit.change(old)
  File "C:\pwb\GIT\core\pywikibot\cosmetic_changes.py", line 277, in change
    new_text = self._change(text)
  File "C:\pwb\GIT\core\pywikibot\cosmetic_changes.py", line 271, in _change
    text = self.safe_execute(method, text)
  File "C:\pwb\GIT\core\pywikibot\cosmetic_changes.py", line 258, in safe_execute
    result = method(text)
  File "C:\pwb\GIT\core\pywikibot\cosmetic_changes.py", line 608, in cleanUpLinks
    text = textlib.replaceExcept(text, linkR, handleOneLink,
  File "C:\pwb\GIT\core\pywikibot\textlib.py", line 422, in replaceExcept
    replacement = new(match)
  File "C:\pwb\GIT\core\pywikibot\cosmetic_changes.py", line 487, in handleOneLink
    is_interwiki = self.site.isInterwikiLink(titleWithSection)
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 1130, in isInterwikiLink
    linkfam, linkcode = pywikibot.Link(text, self).parse_site()
  File "C:\pwb\GIT\core\pywikibot\page\__init__.py", line 6320, in parse_site
    newsite = self._source.interwiki(prefix)
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 948, in interwiki
    return self._interwikimap[prefix].site
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 699, in __getitem__
    raise self._iw_sites[prefix].site
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 649, in site
    self._site = pywikibot.Site(url=self.url)
  File "C:\pwb\GIT\core\pywikibot\tools\__init__.py", line 1797, in wrapper
    return obj(*__args, **__kw)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1233, in Site
    code, fam = _code_fam_from_url(url)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1180, in _code_fam_from_url
    code = family.from_url(url)
  File "C:\pwb\GIT\core\pywikibot\family.py", line 1314, in from_url
    for iw_url in site._interwiki_urls():
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 938, in _interwiki_urls
    yield self.article_path
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 2272, in article_path
    assert self.siteinfo['general']['articlepath'].endswith('/$1'), \
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 1640, in __getitem__
    return self.get(key, False)  # caches and doesn't force it
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 1682, in get
    preloaded = self._get_general(key, expiry)
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 1628, in _get_general
    default_info = self._get_siteinfo(props, expiry)
  File "C:\pwb\GIT\core\pywikibot\site\__init__.py", line 1551, in _get_siteinfo
    data = request.submit()
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 2250, in submit
    self._data = super(CachedRequest, self).submit()
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 1985, in submit
    result = self._json_loads(rawdata)
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 1796, in _json_loads
    self.wait()
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 2109, in wait
    pywikibot.sleep(self.retry_wait)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1328, in sleep
    stopme()
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1341, in stopme
    _flush(False)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1379, in _flush
    _putthread.join(1)
  File "C:\Python38\lib\threading.py", line 1008, in join
    raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

0 pages changed.

C:\pwb\GIT\core>

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
Xqt triaged this task as Medium priority.Apr 18 2020, 6:14 AM

Curiously the JSON resonse warnings were from wikionary:als whereas the bot worked on wikipedia:als; ok wikionary:als redirects to wikipedia:als but why is the Response coming from wikt?

The exceptions raises during page save:

C:\pwb\GIT\core>py -3 pwb.py replace -fix:source -lang:als -page:Wikipedia:Stammtisch/Archiv_2017-1
Retrieving 1 pages from wikipedia:als.


>>> Wikipedia:Stammtisch/Archiv 2017-1 <<<
@@ -645 +645 @@
- <source lang="javascript">
+ <syntaxhighlight lang="javascript">

@@ -649 +649 @@
- </source>
+ </syntaxhighlight>

Do you want to accept these changes? ([y]es, [N]o, [e]dit original, edit
[l]atest, open in [b]rowser, [m]ore context, [a]ll, [q]uit): y
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 5 seconds before retrying.
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 10 seconds before retrying.
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 20 seconds before retrying.
WARNING: Http response status 404
WARNING: Non-JSON response received from server wiktionary:als; the server may be down.
WARNING: Waiting 40 seconds before retrying.
Exception in thread Put-Thread:
Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()