[twill] Downloading a .zip file

Dirk Rothe d.rothe at semantics.de
Wed Feb 16 13:13:12 PST 2011


Try it with patching twill/commands.py Line 311

from
f = open(filename, 'w')
to
f = open(filename, 'wb')

Under Windows the newline \n will be expanded to \r\n.

--dirk

On Wed, 16 Feb 2011 18:46:42 +0100, Avi Bar Massada <barmassada at wisc.edu>
wrote:

> Thanks a lot Adam! I will figure this out eventually :)
>
>
> On 2/16/2011 11:43 AM, Adam Victor Nazareth Brandizzi wrote:
>> On Wed, Feb 16, 2011 at 3:23 PM, Avi Bar Massada<barmassada at wisc.edu>   
>> wrote:
>>> Thanks again Adam, see my comments below.
>>>> That is pretty strange... It can be a problem with the compression
>>>> software you are using. Could you send us the script you are using?
>>>>
>>> Right now I'm using the python command line in Windows XP. I used the
>>> following commands:
>>>
>>> import twill
>>> from twill.commands import *
>>> go("http://data.gbif.org/download/downloadReady.htm?downloadFile=occurrence-search-12978055989365071032693658999911.zip")
>>> follow("occurrence-search-12978055989365071032693658999911.zip")
>>> save_html("occurrence.zip")
>>>
>>> By the way, I tried to follow your original code (the one that points  
>>> to
>>> http://jsfcompref.appspot.com/faces/chapter04.zip) and got exactly the  
>>> same
>>> errors...
>> Well, I'm trying it on a Mac so I cannot emulate your environment...  
>> Sorry.
>>
>> It seems either a problem with your environment or (more probable) a
>> bug in twill. A not-so-buggy bug, anyway, because the "save_html"
>> method is used mainly for, well, save HTML. If I remember well,
>> Windows differentiates between binary (such as ZIP) and text files
>> (such as HTML) and saves them in different ways. Since you are using a
>> function made or saving HTML to save a ZIP file, it can be the
>> problem.
>>
>>>>> BTW, if I save the
>>>>> file without the .zip suffix, and open it from its new location, it
>>>>> prompts
>>>>> me straight to the download dialogue box.
>>>> Do you mean the browser download dialog box? That is way stranger :)
>>>>
>>> Yup, this is the browser download dialogue box...
>> Well, good luck! I hope you solve your problem :)
>>
>
> _______________________________________________
> twill mailing list
> twill at lists.idyll.org
> http://lists.idyll.org/listinfo/twill



More information about the twill mailing list