Re: downloading files

2007-08-03 Thread Steve Holden
Ehsan wrote: > On Aug 3, 10:10 pm, Steve Holden <[EMAIL PROTECTED]> wrote: [...] >> I'm guessing there are binary files and you are running on Windows, >> which is inserting a carriage return before ebery newline. Try >> >> localFile = open(fileName, 'wb') >> >> to avoid thus behavior. [...

Re: downloading files

2007-08-03 Thread Fabio Z Tessitore
Il Fri, 03 Aug 2007 14:32:19 -0700, Ehsan ha scritto: > It works but could you explain more what's wrong with just 'w'? On Unix-like systems newline means '\n' On Window newline means '\r\n' So, when you open a file on Window with 'w' option, Win replace downloaded '\n' with a local '\r\n' an

Re: downloading files

2007-08-03 Thread Ehsan
On Aug 3, 10:10 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Ehsan wrote: > > I foundd this code in ASPN Python Cookbook for downloading files in > > python but when it finished downloading files the files became > > corrupted and didn't open, the files in intern

Re: downloading files

2007-08-03 Thread kyosohma
On Aug 3, 1:48 pm, Ehsan <[EMAIL PROTECTED]> wrote: > I foundd this code in ASPN Python Cookbook for downloading files in > python but when it finished downloading files the files became > corrupted and didn't open, the files in internet havn't any problem: >

Re: downloading files

2007-08-03 Thread Carsten Haese
On Fri, 2007-08-03 at 11:48 -0700, Ehsan wrote: > I foundd this code in ASPN Python Cookbook for downloading files in > python but when it finished downloading files the files became > corrupted and didn't open, the files in internet havn't any problem: > > &g

Re: downloading files

2007-08-03 Thread Steve Holden
Ehsan wrote: > I foundd this code in ASPN Python Cookbook for downloading files in > python but when it finished downloading files the files became > corrupted and didn't open, the files in internet havn't any problem: > > > def download(url,fileName): >

downloading files

2007-08-03 Thread Ehsan
I foundd this code in ASPN Python Cookbook for downloading files in python but when it finished downloading files the files became corrupted and didn't open, the files in internet havn't any problem: def download(url,fileName): """Copy the contents of a file fr

Re: Downloading files using urllib in a for loop?

2006-02-15 Thread justsee
ah - thanks for your help, but what is happening is the first line being returned contains the field names from the csv file! Schoolboy errors :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Downloading files using urllib in a for loop?

2006-02-15 Thread Martin Franklin
[EMAIL PROTECTED] wrote: > Thanks - but have printed and verified they are valid paths and > filenames. One correction to the code I listed: >theurl = imagepath[:-8] > > For some reason the values aren't being passed through > urllib.urlretrieve properly but this makes no sense to me? > A wo

Re: Downloading files using urllib in a for loop?

2006-02-15 Thread Martin Franklin
Martin Franklin wrote: > [EMAIL PROTECTED] wrote: >> Hi, >> I'm using Python 2.3 on Windows for the first time, and am doing >> something wrong in using urllib to retrieve images from urls embedded >> in a csv file. If I explicitly specify a url and image name it works >> fine(commented example in

Re: Downloading files using urllib in a for loop?

2006-02-15 Thread Fredrik Lundh
Martin Franklin wrote: > "No such file or directory: ''" sounds to me like you are trying > to open a file called '' (empty string) > > try adding some debugging > > print theimage, imagepath or, better: print repr(theimage), repr(imagepath) -- http://mail.python.org/mailman/listi

Re: Downloading files using urllib in a for loop?

2006-02-15 Thread justsee
Thanks - but have printed and verified they are valid paths and filenames. One correction to the code I listed: theurl = imagepath[:-8] For some reason the values aren't being passed through urllib.urlretrieve properly but this makes no sense to me? -- http://mail.python.org/mailman/listinfo/

Downloading files using urllib in a for loop?

2006-02-15 Thread justsee
Hi, I'm using Python 2.3 on Windows for the first time, and am doing something wrong in using urllib to retrieve images from urls embedded in a csv file. If I explicitly specify a url and image name it works fine(commented example in the code), but if I pass in variables in this for loop it throws

Re: Downloading files using urllib in a for loop?

2006-02-15 Thread Martin Franklin
[EMAIL PROTECTED] wrote: > Hi, > I'm using Python 2.3 on Windows for the first time, and am doing > something wrong in using urllib to retrieve images from urls embedded > in a csv file. If I explicitly specify a url and image name it works > fine(commented example in the code), but if I pass in

Re: Downloading files using URLLib

2005-06-27 Thread Fuzzyman
> If so please guid me a bit here. I aaume you mean 'guido' here ? ;-) Anyway - you probably want to be using urllib2 as the other poster points out. Regards, Fuzzy -- http://mail.python.org/mailman/listinfo/python-list

Re: Downloading files using URLLib

2005-06-27 Thread A. Murat Eren
Hi, On Monday 27 June 2005 12:10, Oyvind Ostlund wrote: > I have to download a lot of files. And at the moment i am trying with > URLLib. But sometimes it doesn't download the whole file. It looks like it > stops half way through or something. Is it possible to ask for the file > size before you

Downloading files using URLLib

2005-06-27 Thread Oyvind Ostlund
Hello, I have to download a lot of files. And at the moment i am trying with URLLib. But sometimes it doesn't download the whole file. It looks like it stops half way through or something. Is it possible to ask for the file size before you download, and then test afterwards if the whole file wa