[web2py] Re: serving a zip file

2015-01-30 Thread Yebach
Using parts of your code I have a problem with zip file. It appends text to new file in my zip So first worker has in his ics file his data but second one has his and from previous This is my code cal = Calendar() import zipfile, cStringIO exported_chunks_zip = cStringIO.StringIO()

[web2py] Re: serving a zip file

2011-10-16 Thread peter
I have now tried the downloady example remotely, on a linux server with niginx and uswgi. This streams the zip file correctly with both chrome and IE8. So the problem is there only when I use the rocket server on windows. I just tried the rocket server remotely, and streaming is correct. So I on

[web2py] Re: serving a zip file

2011-10-15 Thread peter
This is the code I used, as above def downloady(): import os import contenttype as c path="somepath/album.zip" response.headers['Content-Type'] = c.contenttype(path) response.headers['Content-Disposition'] = 'attachment; filename=album.zip'# to force download as attachment

[web2py] Re: serving a zip file

2011-10-15 Thread Massimo Di Pierro
Why response.headers['Content-Type'] = "application/octet-stream" shouldn't it be response.headers['Content-Type'] = "application/zip" I am not sure this causes the problem but it may be, if IE thinks the data is ascii and not binary. On Oct 15, 4:46 am, peter wrote: > Yes, the downloaded file i

[web2py] Re: serving a zip file

2011-10-15 Thread peter
Yes, the downloaded file is corrupted with IE8 but not with chrome. When I compare the files with a hex editor, they both begin and end the same, however, the last byte of the original file is at 6EA11, whereas the last byte of the downloaded file is at 6D7311. So it appears that it is losing a fe

[web2py] Re: serving a zip file

2011-10-14 Thread Massimo Di Pierro
You mean the downloaded file is corrupted? Can you check the size? On Oct 14, 5:33 pm, peter wrote: > Okay this is where I am now. > > My example 'downloady' above works correctly in chrome but incorrectly > in IE8. In IE8, the file appears to download correctly but will not > unzip. > > Peter >

[web2py] Re: serving a zip file

2011-10-14 Thread peter
Okay this is where I am now. My example 'downloady' above works correctly in chrome but incorrectly in IE8. In IE8, the file appears to download correctly but will not unzip. Peter On Oct 14, 7:13 pm, Matt Broadstone wrote: > On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di > Pierro wrote: > > Wha

[web2py] Re: serving a zip file

2011-10-14 Thread Massimo Di Pierro
I understand. The problem is that response.stream does not form for a StringIO which is not a regular file. StringIO is in memory therefore you have no reason for streaming. filename = "%s-backup" % (time.strftime("%Y%m%d-%H%M")) raw_data = stream = cStringIO.StringIO()

Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di Pierro wrote: > What browser? That was chrome. The previously fix suggested by Brian works for me (thanks!). Matt > > On Oct 14, 10:30 am, Matt Broadstone wrote: >> On Fri, Oct 14, 2011 at 9:35 AM, peter wrote: >> > If I now do exactly what I did one

[web2py] Re: serving a zip file

2011-10-14 Thread Massimo Di Pierro
What browser? On Oct 14, 10:30 am, Matt Broadstone wrote: > On Fri, Oct 14, 2011 at 9:35 AM, peter wrote: > > If I now do exactly what I did one month ago, there is now no error > > with zip streaming. So maybe you have changed things in > > response.stream since then. > > > Peter > > > On Oct

Re: [web2py] Re: serving a zip file

2011-10-14 Thread Matt Broadstone
On Fri, Oct 14, 2011 at 9:35 AM, peter wrote: > If I now do exactly what I did one month ago, there is now no error > with zip streaming. So maybe you have changed things in > response.stream since then. > > Peter > > On Oct 14, 1:24 pm, peter wrote: >> I sent from my wifes >> emailhttp://groups

[web2py] Re: serving a zip file

2011-10-14 Thread peter
If I now do exactly what I did one month ago, there is now no error with zip streaming. So maybe you have changed things in response.stream since then. Peter On Oct 14, 1:24 pm, peter wrote: > I sent from my wifes > emailhttp://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4... >

[web2py] Re: serving a zip file

2011-10-14 Thread peter
I sent from my wifes email http://groups.google.com/group/web2py/browse_thread/thread/fe85dca9e48c79ad However with hindsight I think I did not give sufficient information in my forum entry. I guess I was seeing if other people had had problems with downloading zip files. Today, I just tried the

[web2py] Re: serving a zip file

2011-10-13 Thread Brian M
I wrote a controller a few weeks ago that does this. Takes in big dataset and splits it into multiple CSV files bundled into a zip, all using cStringIO Here's part of it. -- if record_count > 1000: #split into chunks of 500 each and bundle up in a zip file

[web2py] Re: serving a zip file

2011-10-13 Thread Massimo Di Pierro
On Oct 13, 12:46 pm, peter wrote: > As I have reported previously in this forum, I think that > response.stream does not quite stream zip files correctly. I have no bug report about this. Can you tell us more so we can fix it?

[web2py] Re: serving a zip file

2011-10-13 Thread peter
As I have reported previously in this forum, I think that response.stream does not quite stream zip files correctly. So if I were you I would first stream a static zip file, when this is working then try and get your code above working. What I suggest you change in the code above is response.hea

Re: [web2py] Re: serving a zip file

2011-10-13 Thread Matt Broadstone
On Thu, Oct 13, 2011 at 11:34 AM, pbreit wrote: > My first suggestion would be to save the files to disk and serve statically > if possible. I would prefer not to touch the disk if possible, these are not huge files just logs. I think I'm very close, when I serve this without the zipfile code (ju

[web2py] Re: serving a zip file

2011-10-13 Thread pbreit
My first suggestion would be to save the files to disk and serve statically if possible.