Last modified: 2014-09-24 22:53:25 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70659, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68659 - imagetransfer fails badly if specified page does not begin with correct namespace
imagetransfer fails badly if specified page does not begin with correct names...
Status: PATCH_TO_REVIEW
Product: Pywikibot
Classification: Unclassified
Other scripts (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks: pwb_script_tests
  Show dependency treegraph
 
Reported: 2014-07-27 02:49 UTC by John Mark Vandenberg
Modified: 2014-09-24 22:53 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description John Mark Vandenberg 2014-07-27 02:49:00 UTC
$ 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
Comment 1 John Mark Vandenberg 2014-07-27 02:52:05 UTC
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
Comment 2 John Mark Vandenberg 2014-08-03 04:28:37 UTC
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'>
Comment 3 John Mark Vandenberg 2014-08-04 03:05:49 UTC
One part of this is fixed with https://gerrit.wikimedia.org/r/#/c/151396/
Comment 4 Ricordisamoa 2014-09-02 00:52:22 UTC
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.
Comment 5 Gerrit Notification Bot 2014-09-24 22:51:12 UTC
Change 162781 had a related patch set uploaded by Mpaa:
Bug 68659-imagetransfer fails if file doesnt exist

https://gerrit.wikimedia.org/r/162781
Comment 6 Mpaa 2014-09-24 22:53:25 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links