Xqt created this task.
Xqt added a subscriber: Xqt.
Xqt added a project: pywikibot-core.
Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION
One of the recent changes lead to following error:
```
C:\pwb\core>pwb.py redirect double -moves -total:600 -always -lang:war
Traceback (most recent call last):
File "C:\pwb\core\pwb.py", line 159, in <module>
import pywikibot # noqa
File "C:\pwb\core\pywikibot\__init__.py", line 38, in <module>
from pywikibot.exceptions import (
File "C:\pwb\core\pywikibot\exceptions.py", line 485, in <module>
import pywikibot.data.api
ImportError: No module named data.api
^CBatchvorgang abbrechen (J/N)?
```
TASK DETAIL
https://phabricator.wikimedia.org/T94348
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: pywikipedia-bugs, Xqt, Aklapper, jayvdb
XZise added a comment.
That seems sensible. Allow the Site to be a Page as it also stores a Site. If it's a page it could be page relative and otherwise it's always absolute.
TASK DETAIL
https://phabricator.wikimedia.org/T57113
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: happy5214, XZise
Cc: XZise, valhallasw, gerritbot, happy5214, Legoktm, jayvdb, Ladsgroup, pywikipedia-bugs
valhallasw added a comment.
Doh. You're right. That means we have to pass through a Link object, then? I.e. the method would then be
targetpage = Page(Link('/b', oldpage))
which currently doesn't work, as Link requires a Site object (?!):
>>> pywikibot.Link("/b", p)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/valhallasw/src/pywikibot-core/pywikibot/page.py", line 4369, in __init__
"source parameter should be a Site object"
AssertionError: source parameter should be a Site object
TASK DETAIL
https://phabricator.wikimedia.org/T57113
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: happy5214, valhallasw
Cc: XZise, valhallasw, gerritbot, happy5214, Legoktm, jayvdb, Ladsgroup, pywikipedia-bugs
XZise added a comment.
Unfortunately yes, copied from the documentation:
If the first argument is a Page, create a copy of that object.
This can be used to convert an existing Page into a subclass
object, such as Category or FilePage. (If the title is also
given as the second argument, creates a copy with that title;
this is used when pages are moved.)
TASK DETAIL
https://phabricator.wikimedia.org/T57113
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: happy5214, XZise
Cc: XZise, valhallasw, gerritbot, happy5214, Legoktm, jayvdb, Ladsgroup, pywikipedia-bugs
valhallasw added a comment.
I think the correct interpretation of Page(page, title) is 'the page a Link with /title/ links to from Page /page/'. Is there another interpretation that also makes sense? Why would you pass a Page object if it's not where you found the link?
TASK DETAIL
https://phabricator.wikimedia.org/T57113
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: happy5214, valhallasw
Cc: XZise, valhallasw, gerritbot, happy5214, Legoktm, jayvdb, Ladsgroup, pywikipedia-bugs
XZise added subscribers: valhallasw, XZise.
XZise added a comment.
@valhallasw: I'm not sure it's that simple. The current implementation has already a meaning for `Page(page, title)` and title could be “/foo” and then is the question is it's a subpage or not? Afaik it's only a subpage when it's a link on a page (I'm not sure if the namespace has to be a subpages namespace).
TASK DETAIL
https://phabricator.wikimedia.org/T57113
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: happy5214, XZise
Cc: XZise, valhallasw, gerritbot, happy5214, Legoktm, jayvdb, Ladsgroup, pywikipedia-bugs
Mineo created this task.
Mineo added a subscriber: Mineo.
Mineo added a project: pywikibot-core.
Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION
The line https://github.com/mineo/mb2wikidatabot/blob/master/bot/const.py#L36 sometimes causes the whole python interpreter to block, so it doesn't even exit on ^C anymore. Since this might be a very specific problem related to the order things are imported in etc., here's a rough overview of how that line is reached.
https://github.com/mineo/mb2wikidatabot/blob/master/run.py is the main entry point of the bot, which imports
https://github.com/mineo/mb2wikidatabot/blob/master/bot/common.py, which (in line 8) imports the `const.py` file.
I've added print statements around every statement in `const.py` and the one before the creation of the ItemPage is the last one that gets executed.
I have now found a reliable way to fix this and that is the execution of a file that contains only the following code (yes, this is basically a variation of the `const.py` file):
```
import pywikibot as wp
WIKIDATA = wp.Site('wikidata', 'wikidata')
WIKIDATA_DATASITE = WIKIDATA.data_repository()
MUSICBRAINZ_WIKIDATAPAGE = wp.ItemPage(WIKIDATA_DATASITE, "Q14005")
MUSICBRAINZ_CLAIM = wp.Claim(WIKIDATA_DATASITE, "P248")
```
Other ways to fix it include deletions of most files in the pywikibot user directory and/or random invokations of pywikibots `scripts/login.py` script.
This happens on Python 2.6.5 on Ubuntu 10.04.4 in a virtual environment. This has happened over the last few year every once in a while with different revisions of pywikibot, but I feel like it's now happening way more often. The currently used pywikibot version is 6b2e416b1bd67d16cf70f3c02420bd9124217a13.
TASK DETAIL
https://phabricator.wikimedia.org/T87742
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Mineo
Cc: pywikipedia-bugs, Aklapper, Mineo, jayvdb