os.system and wget
Wojtek Walczak
gminick at hacker.pl
Wed Nov 13 11:32:02 EST 2002
Dnia 13 Nov 2002 07:56:48 -0800, zunbeltz napisaĆ(a):
> I've download a web in a python script with
> os.system('wget -q -O foo.txt http://foo.html')
> but later (in same script) i can't open foo.txt
> When the script finished the foo.txt is there, correctly donwloaded.
> What is wrong?
1. Use full/absolute paths:
os.system('/usr/local/bin/wget -q -O/tmp/foo.txt http://URL')
2. Use exceptions:
import sys, os
try:
os.system('command')
except:
print sys.exc_info()[1]
sys.exit()
HTH.
--
[ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ]
[ gminick (at) hacker.pl ][ gminick (at) underground.org.pl ]
More information about the Python-list
mailing list