tosher/Mediawiker

Occasional TypeError exception for get_page

Opened this issue · 7 comments

Trying to open an existing wiki page that I haven't opened on ST opens a blank tab and throws this error in console:

  >>> TypeError exception for get_page: unorderable types: int() > NoneType()
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True

Subsequent attempts usually work, so currently the only inconvenience it causes is I have to close the new tab and re-enter the page name.
I have a Fandom wiki selected, and using ST build 4113 with Mediawiker 3.6.9. This has been an issue in ST3 and since some Mediawiker versions ago (not even sure when it started).

With any page, always?

Yeah, many pages face this problem, but sometimes the page opens up fine on first try.
(Granted, the successful first-time opens may have failed a while ago and I just don't remember it... at least I hope this isn't the case)

Can't reproduce :(
For example, page https://wreckit-woodhouse.fandom.com/wiki/Apple_Metro_Applen opens without errors for me.

ST, Dev channel, latest 4112

That page loads fine for me as well (haven't managed to reproduce for some arbitrary existing page on that test wiki in this brief session).
I swapped back to see if I could open https://thealchemistcode.fandom.com/wiki/Zwei without issue, and it threw error on first try just now. This page has thrown error for me various times.

Here's my attempt at opening a page on wreckit-woodhouse, swapping wikis back to thealchemistcode, and then opening Zwei. The first try failed, but subsequent attempts succeed:

Page [[Wreck-it_Woodhouse/About_Us]] was opened successfully from "wreckit-woodhouse.fandom.com".
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True
  >>> TypeError exception for get_page: unorderable types: int() > NoneType()
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True
Page [[Zwei]] was opened successfully from "The Alchemist Code Wiki".
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True
Page [[Zwei]] was opened successfully from "The Alchemist Code Wiki".
  >>> '''DEBUG''' Get connection from connection manager.
  >>> '''DEBUG''' Cached connection: True

Always without errors for me..

Yoy could try to increase timeout value:
retry_timeout (default: 30),
maybe it will help

Thanks, I'll give retry_timeout a go (trying 40 for now).

By the way, when a page fails to load, this gets dumped to ST console (paths truncated for brevity):

Traceback (most recent call last):
  File "...\Mediawiker\mwcommands\mw_utils.py", line 1072, in on_done
    set_timeout_async(self.callback(title), 0)
  File "...\Mediawiker\mediawiker.py", line 148, in get_section_number
    return self.page_open(self.title)
  File "...\Mediawiker\mediawiker.py", line 177, in page_open
    if utils.api.page_can_edit(page):
  File "...\Mediawiker\mwcommands\mw_utils.py", line 538, in page_can_edit
    return page.can('edit')
AttributeError: 'NoneType' object has no attribute 'can'

It's just result, we received None-object instead of Page-object. I'll add more readable message for this.