<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5700.6" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007>I'm really
confused, and I hope somebody can explain this for me...</SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007>I've been playing
with compression and archives, and have some .zip, .tar, .gz and .tgz example
files to test my code on.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007>I can read them
using either zipfile, tarfile, gzip or zlib, and that's fine. But just reading
them in 'raw' doesn't give me the whole string of (compressed)
bytes.</SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007>i.e...</SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007>len(
file("mytestfile","r").read() ) != <FONT face=Verdana size=2><SPAN
class=722295211-20022007>os.path.getsize("mytestfile")</SPAN></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007><FONT face=Verdana
size=2><SPAN class=722295211-20022007></SPAN></FONT></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007><FONT face=Verdana
size=2><SPAN class=722295211-20022007>Not even close, in fact. It seems like
file.read() just stops after reading a small portion of each example file,
but why would that happen? And what could I do if I wanted to read in the entire
(compressed) contents as a string?</SPAN></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana size=2><SPAN class=722295211-20022007>thanks for any
insight,</SPAN></FONT></DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT> </DIV>
<DIV><FONT face=Verdana size=2><SPAN
class=722295211-20022007></SPAN></FONT><FONT face=Verdana size=2><SPAN
class=722295211-20022007>Dave (using Python 2.4 and windows)</SPAN></FONT><FONT
face=Verdana size=2></FONT></DIV></BODY><br/>
<p>
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
</p>
</HTML>