Thanks for the shutil.copyfileobj.
Oddly, the EOFError didnt work though.
Gabriel Genellina wrote:
En Fri, 22 Aug 2008 16:53:58 -0300, Wojtek Walczak <[EMAIL PROTECTED]> escribió:
On Fri, 22 Aug 2008 22:18:37 +0530, Anjanesh Lekshminarayanan wrote:
Im trying to download a file from a server. But how do I detect EOF ?
Whenever read() method returns empty string/list.
while f1: # When to stop ?
retval = f1.read()
if not retval:
break
f2.write(retval)
Those read() should be read(size) - read() tries to get the whole contents in
memory.
Anyway, shutil.copyfileobj already implements that logic.
--
http://mail.python.org/mailman/listinfo/python-list