https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
Bug ID: 68659 Summary: imagetransfer fails badly if specified page does not begin with correct namespace Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: jayvdb@gmail.com Web browser: --- Mobile Platform: ---
$ python pwb.py imagetransfer -family:wikipedia -lang:en "Joachim_Holst-Jensen_1923.jpg" Traceback (most recent call last): File "pwb.py", line 157, in <module> run_python_file(fn, argv, argvu) File "pwb.py", line 67, in run_python_file exec(compile(source, filename, "exec"), 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 273, in run {'title': page.title(), 'ns': pywikibot.Site().image_namespace()}) File ".../pywikibot/data/api.py", line 856, in result p = PageGenerator.result(self, pagedata) File ".../pywikibot/data/api.py", line 840, in result update_page(p, pagedata) File ".../pywikibot/data/api.py", line 996, in update_page "Page %s has neither 'pageid' nor 'missing' attribute" % pagedict['title']) AssertionError: Page Joachim Holst-Jensen 1923.jpg has neither 'pageid' nor 'missing' attribute <type 'exceptions.AssertionError'> CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
--- Comment #1 from John Mark Vandenberg jayvdb@gmail.com --- It also fails quite badly if the file doesnt exist.
$ python pwb.py imagetransfer -family:wikipedia -lang:en "File:Joachim_Holst-Jensen_1923" ------------------------------------------------------------ 0. Found image: [[File:Joachim Holst-Jensen 1923]] ============================================================ Traceback (most recent call last): File "pwb.py", line 157, in <module> run_python_file(fn, argv, argvu) File "pwb.py", line 67, in run_python_file exec(compile(source, filename, "exec"), 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 289, in run if imagelist[todo].fileIsShared(): File ".../pywikibot/page.py", line 1827, in fileIsShared return self.fileUrl().startswith( File ".../pywikibot/page.py", line 1803, in fileUrl self._imageinfo = self.site.loadimageinfo(self) File ".../pywikibot/site.py", line 1445, in loadimageinfo if history else pageitem['imageinfo'][0]) KeyError: 'imageinfo' <type 'exceptions.KeyError'> CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
--- Comment #2 from John Mark Vandenberg jayvdb@gmail.com --- It also fails if no arguments are given at all
$ python pwb.py imagetransfer -family:wikipedia -lang:en Traceback (most recent call last): File "pwb.py", line 157, in <module> run_python_file(fn, argv, argvu) File "pwb.py", line 67, in run_python_file exec(compile(source, filename, "exec"), 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 273, in run {'title': page.title(), 'ns': pywikibot.Site().image_namespace()}) File ".../pywikibot/data/api.py", line 883, in result p = PageGenerator.result(self, pagedata) File ".../pywikibot/data/api.py", line 867, in result update_page(p, pagedata) File ".../pywikibot/data/api.py", line 1023, in update_page "Page %s has neither 'pageid' nor 'missing' attribute" % pagedict['title']) AssertionError: Page has neither 'pageid' nor 'missing' attribute <type 'exceptions.AssertionError'>
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
--- Comment #3 from John Mark Vandenberg jayvdb@gmail.com --- One part of this is fixed with https://gerrit.wikimedia.org/r/#/c/151396/
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |69069
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
Ricordisamoa ricordisamoa@openmailbox.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |NEW CC| |ricordisamoa@openmailbox.or | |g Component|General |Other scripts
--- Comment #4 from Ricordisamoa ricordisamoa@openmailbox.org --- imagetransfer.py now shows a help message when called with no arguments. However, it still fails if the specified page does not exist or does not begin with the correct namespace.
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
--- Comment #5 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 162781 had a related patch set uploaded by Mpaa: Bug 68659-imagetransfer fails if file doesnt exist
https://gerrit.wikimedia.org/r/162781
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=68659
Mpaa mpaa.wiki@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mpaa.wiki@gmail.com
--- Comment #6 from Mpaa mpaa.wiki@gmail.com --- I do not think this is a bug: the specified page does not exist or does not begin with the correct namespace.
Input page does not necessarily belongs to File: namespace.
"If pagename is an image description page, offers to copy the image to the target site. If it is a normal page, it will offer to copy any of the images used on that page, or if the -interwiki argument is used, any of the images used on a page reachable via interwiki links."
Now it fails gracefully, however.
pywikipedia-bugs@lists.wikimedia.org