jayvdb created this task. jayvdb added a subscriber: jayvdb. jayvdb added a project: Pywikibot-Other-scripts.
TASK DESCRIPTION imagetransfer support three main modes: 1. an image page 2. images on a page 3. images on interwikis of a page
Only the first mode works in core.
Using "images on a page" mode creates an exception:
``` $ python pwb.py scripts/imagetransfer.py -family:wikipedia -lang:en "Foobar" ... Traceback (most recent call last): File "pwb.py", line 222, in <module> run_python_file(filename, argv, argvu, file_package) File "pwb.py", line 81, in run_python_file main_mod.__dict__) File "./scripts/imagetransfer.py", line 356, in <module> main() File "./scripts/imagetransfer.py", line 353, in main bot.run() File "./scripts/imagetransfer.py", line 278, in run {'title': page.title(), 'ns': pywikibot.Site().image_namespace()}) File "/home/jvanden3/projects/pywiki/test-core/pywikibot/data/api.py", line 1680, in result p = PageGenerator.result(self, pagedata) File "/home/jvanden3/projects/pywiki/test-core/pywikibot/data/api.py", line 1662, in result update_page(p, pagedata, self.props) File "/home/jvanden3/projects/pywiki/test-core/pywikibot/data/api.py", line 1844, in update_page "Page %s has neither 'pageid' nor 'missing' attribute" % pagedict['title']) AssertionError: Page Foobar has neither 'pageid' nor 'missing' attribute Found 1 commons:commons processes running, including this one. Dropped throttle(s). <type 'exceptions.AssertionError'> ```
The code from https://gerrit.wikimedia.org/r/#/c/101623/1 is very bizarre. ``` imagePage = (page.imagelinks(followRedirects=True)).result( {'title': page.title(), 'ns': pywikibot.Site().image_namespace()}) ```
imagelinks() returns a ImagePageGenerator, which does have a result() method which does not need to be called, as it has already been called within imagelinks() before the page is yielded.
Because of T86623, using -interwiki fails ``` $ python pwb.py scripts/imagetransfer.py -family:wikipedia -lang:en "File:1801-2001_population_change_of_Astley_Abbotts.jpg" -interwiki ... Traceback (most recent call last): File "pwb.py", line 222, in <module> run_python_file(filename, argv, argvu, file_package) File "pwb.py", line 81, in run_python_file main_mod.__dict__) File "./scripts/imagetransfer.py", line 353, in <module> main() File "./scripts/imagetransfer.py", line 350, in main bot.run() File "./scripts/imagetransfer.py", line 269, in run imagelist.append(linkedPage.imagelinks(followRedirects=True)) AttributeError: 'Link' object has no attribute 'imagelinks' Found 1 wikipedia:mk processes running, including this one. Dropped throttle(s). <type 'exceptions.AttributeError'> ```
However even with that fixed, -interwiki also uses list.append to add a generator, instead of an item, to the list.
TASK DETAIL https://phabricator.wikimedia.org/T86627
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: jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review. gerritbot added a comment.
Change 184589 had a related patch set uploaded (by John Vandenberg): Fix port of imagetransfer
https://gerrit.wikimedia.org/r/184589
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T86627
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: gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 162781 had a related patch set uploaded (by XZise): imagetransfer fails if file doesnt exist
https://gerrit.wikimedia.org/r/162781
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T86627
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: gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 184589 merged by jenkins-bot: Fix port of imagetransfer
https://gerrit.wikimedia.org/r/184589
TASK DETAIL https://phabricator.wikimedia.org/T86627
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: gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
XZise closed this task as "Resolved". XZise claimed this task.
TASK DETAIL https://phabricator.wikimedia.org/T86627
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: XZise Cc: jayvdb, Aklapper, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org