>> Im trying to download a file from a server. But how do I detect EOF ?

Shouldn't this work as well?

f1 = urllib2.urlopen('ftp://username:[EMAIL PROTECTED]/data.zip')
f2 = file("data.zip", "wb")

while f1: # When to stop ?
    try :
        f2.write(f1.read(1024))
    except EOFError :
        break

f1.close()
f2.close()

Not that it's really any better, if it works...  I'm wondering myself.

Eric
--
http://mail.python.org/mailman/listinfo/python-list
  • EOF Anjanesh Lekshminarayanan
    • Re: EOF Wojtek Walczak
      • Re: EOF Eric Wertman
      • Re: EOF Gabriel Genellina
        • Re: EOF Anjanesh Lekshminarayanan

Reply via email to