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
Version: core-(2.0)
Severity: enhancement