josiahrulez
June 21st, 2013, 04:23 PM
Hey all,
I'm writing a python script to download a bunch of urls from an xml file. I have it working with wget, but how can i get it to write a log file and stop the script if any errors are returned?
import subprocess
downloadlocation = r'c:\users\public\downloads\test.exe'
url = 'http://downloads.sourceforge.net/project/gnuwin32/wget/1.11.4-1/wget-1.11.4-1-setup.exe'
wget = r'C:\Program Files (x86)\GnuWin32\bin\wget.exe'
subprocess.call([wget, '-O', downloadlocation, url, '--progress=bar:force'])
How can i do this?
Thanks
I'm writing a python script to download a bunch of urls from an xml file. I have it working with wget, but how can i get it to write a log file and stop the script if any errors are returned?
import subprocess
downloadlocation = r'c:\users\public\downloads\test.exe'
url = 'http://downloads.sourceforge.net/project/gnuwin32/wget/1.11.4-1/wget-1.11.4-1-setup.exe'
wget = r'C:\Program Files (x86)\GnuWin32\bin\wget.exe'
subprocess.call([wget, '-O', downloadlocation, url, '--progress=bar:force'])
How can i do this?
Thanks