Manual talk:Pywikibot/upload.py

403 Forbidden error
Hi,

When I try to upload an image using this script I get a 403 Forbidden page back. Manually uploading using the bot user account works and editing an article using the editarticly.py script works to. Anybody knows why upload.py does not work? I'm running Mediawiki 1.6.3 and am using the newest upload.py available. thnx --GrandiJoos 18:16, 1 May 2006 (UTC)

An Idea
GrandiJoos - You should be able to get information about why the page is forbidden by checking the server logs. These should be available through your web hosting service, and are automatically kept by the web server program (like Apache). In general there are two reasons for a 403 error: wrong permissions on the file, or wrong un/pw. If you are able to access your wiki when you log in, then you are probably requesting a nonexistent file. The server logs should record every file that was requested by a client that it couldn't find.

Also, make sure you check the path specified by grandijooswiki_family.py (or whatever_family.py) is accurate. This is the default:

def path(self, code): return '/wiki/index.php'

And if your wiki is in the root folder of your server, you might need this:

def path(self, code): return '/index.php'

Hope that helps

Ioneil 22:05, 20 May 2006 (UTC)

'utf8' Can't Decode Byte
I am able to log in without any problems, but when I try to upload any image (using URL or local file) to the server, I get the following error message:

Traceback (most recent call last): File "C:\Documents and Settings\Jim\My Documents\Downloads\Applications\Python WikiBot\pywikipedia\upload.py", line 251, in ? main(sys.argv[1:]) File "C:\Documents and Settings\Jim\My Documents\Downloads\Applications\Python WikiBot\pywikipedia\upload.py", line 247, in main bot.run File "C:\Documents and Settings\Jim\My Documents\Downloads\Applications\Python WikiBot\pywikipedia\upload.py", line 229, in run return self.upload_image File "C:\Documents and Settings\Jim\My Documents\Downloads\Applications\Python WikiBot\pywikipedia\upload.py", line 201, in upload_image returned_html = returned_html.decode(self.targetSite.encoding) File "C:\Python24\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0xa9 in position 342: unexpected code byte

I get the same error no matter what image file I use. I am running python 2.4 on Windows XP, and my user-config.py setting are:

mylang = 'en' family = 'uwpn' usernames['uwpn']['en'] = 'WikiBot' console_encoding = 'utf-8'

Any advice?

Ioneil 21:58, 20 May 2006 (UTC)

Upload multiple files?
Can I upload multiple files at once with this .py file? Odessaukrain 04:37, 8 January 2007 (UTC)
 * I hacked together Uploadmultiple.py which did the job for me. It's sloppy, but seems to work well enough. -Jonathan Kovaciny 21:57, 8 June 2007 (UTC)

Block Warnings
Is there any way to blog all warnings (like chaching name, file bigger them 150k, overwriting file etc.)?

Problem
I repeatedly get the following error message. I am able to upload images using Commons:Special:Upload. I am able to upload text using pagefromfile.py. A similar problem was reported in April. I would welcome suggestions.

Walter Siegmund (talk) 00:24, 16 May 2010 (UTC)


 * If you're having this problem on Mac OS X, it's because of a weird problem introduced by the socket implementation for OS X see here. You can easily fix it for pywikipedia by adding  to your  . If you're not on OS X, I'm not sure what's causing the problem for you.

Error creating thumbnail (solved)
The image shows that it uploads fine in pywikipediabot, but when looking at the image, :
 * Error creating thumbnail: /usr/bin/convert: Unrecognized option (-thumbnail).

Adamtheclown 10:27, 19 November 2010 (UTC)
 * solution found here. Adamtheclown 10:35, 19 November 2010 (UTC)

Uploadmultiple.py
The uploadmultiple.py bot is a dead project? Here the content page. Sorry for my little english! --79.35.55.159 22:09, 7 November 2012 (UTC)

-summary does not work (done)
User:Framawiki it seems that summary is not working on toolforge:

tools.svgworkaroundbot@tools-bastion-03:~/SVGWorkaroundBot/cleanupSVG-master$ python /data/project/shared/pywikipedia/core/scripts/upload.py Oxygen480-status-weather-mist.svg -keep -ignorewarn -summary MySummary The suggested description is: MySummary Do you want to change this description? ([y]es, [N]o, [q]uit): n Uploading file to commons:commons... ERROR: Upload error: Traceback (most recent call last): File "/data/project/shared/pywikibot/core/pywikibot/specialbots.py", line 430, in upload_file comment=self.summary)  File "/data/project/shared/pywikibot/core/pywikibot/page.py", line 2682, in upload     **kwargs) File "/data/project/shared/pywikibot/core/pywikibot/tools/__init__.py", line 1738, in wrapper return obj(*__args, **__kw) File "/data/project/shared/pywikibot/core/pywikibot/site.py", line 6194, in upload raise ValueError('APISite.upload: cannot upload file without ' ValueError: APISite.upload: cannot upload file without a summary/description. 1 pages read 0 pages written Script terminated successfully.

tools.svgworkaroundbot@tools-bastion-03:~/SVGWorkaroundBot/cleanupSVG-master$ python /data/project/shared/pywikipedia/core/scripts/upload.py Oxygen480-status-weather-mist.svg -keep -ignorewarn -noverify -summary MySummary The suggested description is: MySummary Uploading file to commons:commons... ERROR: Upload error: Traceback (most recent call last): File "/data/project/shared/pywikibot/core/pywikibot/specialbots.py", line 430, in upload_file comment=self.summary)  File "/data/project/shared/pywikibot/core/pywikibot/page.py", line 2682, in upload     **kwargs) File "/data/project/shared/pywikibot/core/pywikibot/tools/__init__.py", line 1738, in wrapper return obj(*__args, **__kw) File "/data/project/shared/pywikibot/core/pywikibot/site.py", line 6194, in upload raise ValueError('APISite.upload: cannot upload file without ' ValueError: APISite.upload: cannot upload file without a summary/description. 1 pages read 0 pages written Script terminated successfully.

I used -descfile and now it works JoKalliauer (talk) 21:52, 4 March 2019 (UTC)
 * Hello, you set no summary there. You should use . What you've done you set uploaded file description, not summary. --Dvorapa (talk) 22:26, 23 March 2019 (UTC)
 * I thougth description is the Page and the Summary is whats written in the #filehistory for each versions. So in https://commons.wikimedia.org/w/index.php?title=File:Oxygen480-devices-tools-media-optical-format.svg&diff=prev&oldid=341549170#filehistory "WorkaroundBotsvg2validsvg.sh" is the description not the summary? And the Summary is "SVGWorkaroundBot uploaded a new version of File:Oxygen480-devices-tools-media-optical-format.svg" ? JoKalliauer (talk) 19:53, 24 March 2019 (UTC)
 * Summary is what is written in the page history (https://commons.wikimedia.org/w/index.php?title=File:Oxygen480-devices-tools-media-optical-format.svg&action=history) and your should fill it using . Description is what is written in the #filehistory and you should fill it using  . Your issue was you used   without any value. You should use either:
 * or  to use default summary. --Dvorapa (talk) 20:34, 24 March 2019 (UTC)
 * Thanks for your answer ✅ JoKalliauer (talk) 07:19, 25 March 2019 (UTC)
 * Thanks for your answer ✅ JoKalliauer (talk) 07:19, 25 March 2019 (UTC)