Closed GoogleCodeExporter closed 8 years ago
What do you mean when you say "read-only file"? A file that is set as read-only
by the OS or a file opened with mode r? I tested on Linux and Windows and
couldn't reproduce this:
>>> from wikitools import *
>>> site = wiki.Wiki('http://www.mediawiki.org/w/api.php')
>>> site.login('user', 'pass')
True
>>> wfile = wikifile.File(site, 'Test6.jpg')
>>> wfile
<wikitools.wikifile.File 'File:Test6.jpg' using
'http://www.mediawiki.org/w/api.php'>
>>> tmp = open('Example.jpg', 'rb')
>>> wfile.upload(fileobj=tmp, ignorewarnings=True)
{u'upload': {u'result': u'Success', ...lots of stuff ...}}
The file was chmod'd to 400, and I also tested with mode r instead of rb.
Original comment by MrZmanwiki@gmail.com
on 25 Jun 2010 at 11:16
Actually, I think the problem was that the file was read only, but all of the
file had been "read" by the point is was uploaded. Once I got rid of the 'read'
line, it worked, but it took a while to realize what the problem was. The
stalling was a red herring!
Original comment by douglasm...@gmail.com
on 26 Jun 2010 at 2:14
Yes, that's correct, it needs to be at the beginning of the file. I've changed
it in r349 to reset to the beginning of the file.
Original comment by MrZmanwiki@gmail.com
on 26 Jun 2010 at 4:12
Original issue reported on code.google.com by
douglasm...@gmail.com
on 25 Jun 2010 at 8:42