jihoonham / spynner

Automatically exported from code.google.com/p/spynner
GNU General Public License v3.0
0 stars 0 forks source link

Flaws in download function #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
pls check out the following code with comments

#!/usr/bin/python

import spynner

browser = spynner.Browser()
browser.debug_level = spynner.DEBUG
browser.create_webview()
browser.load("http://techrice.com/wp-content/uploads/2011/01/4794_sora_aoi_fw00-
200x300.jpg")
#browser.wait_load()  # if use wait_load(), then the following download() won't 
start
browser.download("http://techrice.com/wp-content/uploads/2011/01/4794_sora_aoi_f
w00-200x300.jpg",open("testd.jpg","w")) 
#the download picture is not completed and cannot be opened, the same for html 
and other type of files (also I tried to download "http://www.baidu.com", the 
HTML file is not complete). don't know if there's any way to set the timeout 
parameter or how to ensure the download is completed. 

What version of the product are you using? On what operating system?
The most updated version. Windows xp

Please provide any additional information below.

Original issue reported on code.google.com by jackhome...@sina.com on 8 Apr 2011 at 7:49

GoogleCodeExporter commented 9 years ago
broswer.load must be used only for normal browsing pages, not for files, use 
"download" directly.

and by the way, it's my understanding that binary files in windows require 
explicit open(filename, "wb")), that should explain why you cannot open it.

Original comment by tokland on 8 Apr 2011 at 8:11

GoogleCodeExporter commented 9 years ago

Original comment by tokland on 8 Apr 2011 at 8:39