>
> urllib.urlretrieve(url.strip(),save_to)
>
could be changed into this :
folder = '/home/html-data/'
urllib.urlretrieve(url.strip(),folder+save_to)



2008/7/31 swati jarial <[EMAIL PROTECTED]>

> Hello,
>
> I am new to python this is the code I have written to download a file from
> the internet and then send en email if any error occurs during download. I
> just want know how to specify which folder to download my files. It
> automatically downloads file to the directory where TEST1.txt sits...
>
> import urllib
> import traceback
> import sys
> import cStringIO
> import ncbi_SendEmail
> import os.path
> import os
>
> try:
>
>     for url in open("test1.txt"):
>         save_to = os.path.basename(url.strip())
>         urllib.urlretrieve(url.strip(),save_to)
>
> except:
>     mssg = cStringIO.StringIO()
>     traceback.print_exc(file=mssg)
>     ncbi_SendEmail.email(mssg.getvalue());
>     mssg.close()
>
>
>
> Thanks a Ton!
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to