Bugs item #1795683, was opened at 2007-09-16 10:05 Message generated for change (Comment added) made by cosoleto You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1795683...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jani Patokallio (jpatokal) Assigned to: Nobody/Anonymous (nobody) Summary: No error message if download is interrupted
Initial Comment: I'm using imagetransfer.py to download some images off a Mediawiki site, using the following very straightforward code:
uo = wikipedia.MyURLopener() img = uo.open(url) file = open(targetFile, "w"); file.write(img.read()) file.close() img.close()
However, I found out the hard way that there is no warning of any kind if the download is interrupted halfway through for any reason. Worse yet, there is no practical way to check if the file was downloaded successfully: the MD5 checksum function requires downloading the image and is thus subject to the same bug! The only way to determine even the file's actual size requires hacking through the file version history, and the getFileVersionHistory() command seems to break against the Mediawiki version of Wikitravel anyway.
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2007-09-20 16:14
Message: Logged In: YES user_id=181280 Originator: NO
*in r4334, not r3443.
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2007-09-20 16:08
Message: Logged In: YES user_id=181280 Originator: NO
getFileVersionHistory() problem fixed in revision 4305. upload_image() problems related to interrupted download improved in r3443.
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2007-09-17 18:23
Message: Logged In: YES user_id=181280 Originator: NO
Try this: http://sourceforge.net/tracker/index.php?func=detail&aid=1796316&gro....
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2007-09-17 04:11
Message: Logged In: NO
So I managed to fix getFileVersionHistory by borrowing the code from an older version of pywikipediabot that works with Mediawiki 1.10.1, and now I can at least compare sizes. Can you make your patch available?
----------------------------------------------------------------------
Comment By: Francesco Cosoleto (cosoleto) Date: 2007-09-16 19:05
Message: Logged In: YES user_id=181280 Originator: NO
I have tried to fix your getVersionHistory() problem. You can read file length in HTTP headers too:
f.info().getheader('Content-Length')
I have written a improvised and fully untested patch to wikipedia.getUrl() with check length and transfer resume feature, but I am not sure it's useful.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1795683...