webcomm wrote:
> On Jan 12, 11:53 am, "Chris Mellon" wrote:
[file distribution horror story ...]
>> It's worth pointing out (although the provider probably doesn't care)
>> that this isn't really an XML document and this was a bad way of them
>> to distribute the data. If they'd used a correctly f
On Jan 12, 11:53 am, "Chris Mellon" wrote:
> On Sat, Jan 10, 2009 at 1:32 PM,webcomm wrote:
> > On Jan 9, 7:33 pm, John Machin wrote:
> >> It is not impossible for a file with dummy data to have been
> >> handcrafted or otherwise produced by a process different to that used
> >> for a real-data f
On Sat, Jan 10, 2009 at 1:32 PM, webcomm wrote:
> On Jan 9, 7:33 pm, John Machin wrote:
>> It is not impossible for a file with dummy data to have been
>> handcrafted or otherwise produced by a process different to that used
>> for a real-data file.
>
> I knew it was produced by the same process,
If anyone's interested, here are my django views...
from django.shortcuts import render_to_response
from django.http import HttpResponse
from xml.etree.ElementTree import ElementTree
import urllib, base64, subprocess
def get_data(request):
service_url = 'http://www.something.com/webservices/
On Jan 9, 7:33 pm, John Machin wrote:
> It is not impossible for a file with dummy data to have been
> handcrafted or otherwise produced by a process different to that used
> for a real-data file.
I knew it was produced by the same process, or I wouldn't have shared
it. : )
But you couldn't have
On Jan 10, 9:52 am, webcomm wrote:
> On Jan 9, 5:21 pm, John Machin wrote:
>
> > Thanks. Would you mind spending a few minutes more on this so that we
> > can see if it's a problem that can be fixed easily, like the one that
> > Chris Mellon reported?
>
> Don't mind at all. I'm now working with
w byte first), but without
the initial byte order mark. Python's zipfile module says "BadZipfile:
File is not a zip file".
If I strip off all but the last 4 zero-bytes then the zipfile module can
open it:
decoded = base64.b64decode(datum)
five_zeros = chr(0) * 5
while decoded.endswi
hout
the initial byte order mark. Python's zipfile module says "BadZipfile:
File is not a zip file".
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 9, 5:21 pm, John Machin wrote:
> Thanks. Would you mind spending a few minutes more on this so that we
> can see if it's a problem that can be fixed easily, like the one that
> Chris Mellon reported?
>
Don't mind at all. I'm now working with a zip file with some dummy
data I downloaded fr
On Jan 10, 2:22 am, webcomm wrote:
> On Jan 9, 5:42 am, John Machin wrote:
>
> > And here's a little gadget that might help the diagnostic effort; it
> > shows the archive size and the position of all the "magic" PKnn
> > markers. In a "normal" uncommented archive, EndArchive_pos + 22 ==
> > arch
On Jan 9, 5:00 pm, webcomm wrote:
> If I unzip it like this...
> popen("unzip data.zip")
> ...then the bad characters are 'FFFD' characters as described and
> pictured
> here...http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
trying again to post the link re: FFFD chara
On Jan 8, 8:39 pm, "James Mills" wrote:
> Send us a sample of this file in question...
Here's a sample with some dummy data from the web service:
http://webcomm.webfactional.com/htdocs/data.zip
That's the zip created in this line of my code...
f = open('data.zip', 'wb')
If I open the file it co
On Jan 10, 5:32 am, Scott David Daniels wrote:
> webcomm wrote:
> > I tried Scott's getzip() function yesterday... I
> > stumbled upon it in my searches. It didn't seem to help in my case,
> > though it did produce a different error: ValueError, substring not
> > found. Not sure what that
On Jan 9, 1:32 pm, Scott David Daniels wrote:
> I'd certainly try to figure out if the archive was mis-handled
> somewhere along the way.
Quite possible that I'm mishandling something, or the service provider
is mishandling something. Probably the former. Please see this more
recent thread...
webcomm wrote:
I tried Scott's getzip() function yesterday... I
stumbled upon it in my searches. It didn't seem to help in my case,
though it did produce a different error: ValueError, substring not
found. Not sure what that means.
and in another message webcomm wrote:
> I ran the diag
I missed the begining of this thread and so appologise if I'm repeating what
someone else has said!
I had a very similar problem with this error and it turned out it was due to
me moving a file across a socket connection and either not reading it or
writing it in the binary mode, ie open(filename,
On Jan 9, 10:14 am, "Chris Mellon" wrote:
> This is a ticket about another issue or 2 with invalid zipfiles that
> the zipfile module won't load, but that other tools will compensate
> for:
>
> http://bugs.python.org/issue1757072
Looks like I just need to do this to unzip with unix...
from os im
On Jan 9, 10:14 am, "Chris Mellon" wrote:
> This is a ticket about another issue or 2 with invalid zipfiles that
> the zipfile module won't load, but that other tools will compensate
> for:
>
> http://bugs.python.org/issue1757072
Hmm. That's interesting. Are there other tools I can use in a pyt
On Jan 9, 5:42 am, John Machin wrote:
> And here's a little gadget that might help the diagnostic effort; it
> shows the archive size and the position of all the "magic" PKnn
> markers. In a "normal" uncommented archive, EndArchive_pos + 22 ==
> archive_size.
I ran the diagnostic gadget...
archi
On Fri, Jan 9, 2009 at 9:05 AM, webcomm wrote:
> On Jan 9, 3:46 am, Carl Banks wrote:
>> The zipfile format is kind of brain dead, you can't tell where the end
>> of the file is supposed to be by looking at the header. If the end of
>> file hasn't yet been reached there could be more data. To m
On Jan 9, 3:46 am, Carl Banks wrote:
> The zipfile format is kind of brain dead, you can't tell where the end
> of the file is supposed to be by looking at the header. If the end of
> file hasn't yet been reached there could be more data. To make
> matters worse, somehow zip files came to have t
On Jan 9, 3:16 am, Steven D'Aprano wrote:
> The full signature of ZipFile is:
>
> ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True)
>
> Try passing compression=zipfile.ZIP_DEFLATED and/or allowZip64=False and
> see if that makes any difference.
Those arguments didn't make a differe
On Jan 9, 7:46 pm, Carl Banks wrote:
> On Jan 9, 2:16 am, Steven D'Aprano
>
>
>
>
> cybersource.com.au> wrote:
> > On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote:
> > > The error...
> > ...
> > > BadZipfile: File is not a zip file
>
&
On Fri, 09 Jan 2009 00:46:27 -0800, Carl Banks wrote:
> On Jan 9, 2:16 am, Steven D'Aprano cybersource.com.au> wrote:
>> On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote:
>> > The error...
>> ...
>> > BadZipfile: File is not a zip file
>>
>>
On Jan 9, 7:16 pm, Steven D'Aprano wrote:
> On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote:
> > The error...
> ...
> > BadZipfile: File is not a zip file
>
> > When I look at data.zip in Windows, it appears to be a valid zip file.
> > I am able to unc
On Jan 9, 2:16 am, Steven D'Aprano wrote:
> On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote:
> > The error...
> ...
> > BadZipfile: File is not a zip file
>
> > When I look at data.zip in Windows, it appears to be a valid zip file.
> > I am able to unc
> What would cause a zip file to not have a table of contents?
AFAICT, _EndRecData is failing to find the "end of zipfile" structure in
the file. You might want debug through it to see where it looks, and how
it decides that this structure is not present in the file. Towards
22 bytes before the en
On Thu, 08 Jan 2009 16:47:39 -0800, webcomm wrote:
> The error...
...
> BadZipfile: File is not a zip file
>
> When I look at data.zip in Windows, it appears to be a valid zip file.
> I am able to uncompress it in Windows XP, and can also uncompress it
> with 7-Zip. It loo
On Jan 8, 8:54 pm, MRAB wrote:
> Have you tried gzip instead?
There's no option to download the data in a gzipped format. The files
are .zip archives.
--
http://mail.python.org/mailman/listinfo/python-list
webcomm wrote:
On Jan 8, 8:02 pm, MRAB wrote:
You're just creating a file called "data.zip". That doesn't make it
a zip file. A zip file has a specific format. If the file doesn't
have that format then the zipfile module will complain.
Hmm. When I open it in Windows or with 7-Zip, it contain
On Jan 8, 8:39 pm, "James Mills" wrote:
> Send us a sample of this file in question...
It contains data that I can't share publicly. I could ask the
providers of the service if they have a dummy file I could use that
doesn't contain any real data, but I don't know how responsive they'll
be. It'
On Fri, Jan 9, 2009 at 11:28 AM, webcomm wrote:
> Hmm. When I open it in Windows or with 7-Zip, it contains a text file
> that has the data I would expect it to have. I guess that alone
> doesn't necessarily prove it's a zip file?
>
> datum is something I'm downloading via a web service. The pr
On Jan 8, 8:02 pm, MRAB wrote:
> You're just creating a file called "data.zip". That doesn't make it a
> zip file. A zip file has a specific format. If the file doesn't have
> that format then the zipfile module will complain.
Hmm. When I open it in Windows or with 7-Zip, it contains a text file
_
self._GetContents()
File "C:\Python25\lib\zipfile.py", line 366, in _GetContents
self._RealGetContents()
File "C:\Python25\lib\zipfile.py", line 378, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file
When I l
self._GetContents()
File "C:\Python25\lib\zipfile.py", line 366, in _GetContents
self._RealGetContents()
File "C:\Python25\lib\zipfile.py", line 378, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file
When I look a
35 matches
Mail list logo