Last modified: 2014-10-07 13:27:52 UTC
Uploads are disabled on Wikidata: https://www.wikidata.org/wiki/Special:Upload upload.py happily allows the user to attempt to upload, but then reports an APIError. If pywikibot cant detect whether uploads are enabled before upload, it should detect this APIError and provide a nice response for the user. $ python pwb.py -family:wikidata -lang:wikidata scripts/upload.py No input filename given File or URL where image is now: blahblah.png The filename on the target wiki will default to: blahblah.png Enter a better name, or press enter to accept: The suggested description is: Do you want to change this description? ([y]es, [N]o) y Uploading file to wikidata:wikidata via API.... Reading file blahblah.png ERROR: Upload error: Traceback (most recent call last): File "scripts/upload.py", line 216, in upload_image ignore_warnings=self.ignoreWarning) File ".../pywikibot/site.py", line 3432, in upload result = req.submit() File ".../pywikibot/data/api.py", line 418, in submit raise APIError(code, info, **result["error"]) APIError: uploaddisabled: Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true
See https://gerrit.wikimedia.org/r/156465
It is a bit better now, as there is no traceback, but the check and error needs to occur before asking the user a lot of questions. $ python pwb.py upload -family:wikidata -lang:test No input filename given File or URL where image is now: https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png The filename on the target wiki will default to: PNG_transparency_demonstration_1.png Enter a better name, or press enter to accept: The suggested description is: It is not possible to upload a file without a summary/description. Do you want to change this description? ([Y]es, [n]o, [q]uit) y Uploading file to wikidata:test via API.... Reading file https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png WARNING: API warning (tokens): action=tokens has been deprecated. Please use action=query&meta=tokens instead. ERROR: Upload error: Local file uploads are disabled on wikidata:test.
We might need to be avare of bug 33731. John suggested to download the HTML Code of Special:Upload and check if the upload edit box is present.
I submitted this patch. Do not why it was not logged here: https://gerrit.wikimedia.org/r/#/c/159836/
Oh nevermind. Bug 33731 is emitting not 'uploaddisabled' so it's not related to this.
(In reply to Mpaa from comment #4) > I submitted this patch. Do not why it was not logged here: > https://gerrit.wikimedia.org/r/#/c/159836/ See http://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines for the required format.