When I use only -P or -O with wget only, everything works as advertised.
$: wget -P "test" http://www.google.com/intl/en_com/images/srpr/logo3w.png Saving to: `test/logo3w.png'
.
$: wget -O "google.png" http://www.google.com/intl/en_com/images/srpr/logo3w.png 2012-01-23 21:47:33 (1.20 MB/s) - `google.png' saved [7007/7007]
However, combining the two reasons wget ignores -P .
$: wget -P "test" -O "google.png" http://www.google.com/intl/en_com/images/srpr/logo3w.png 2012-01-23 21:47:51 (5.87 MB/s) - `google.png' saved [7007/7007]
I set a variable for the directory (generated by the last fragment of the URL) and the file name (generated by the count loop), so http://www.google.com/aaa/bbb/ccc gives file = /directory/filename , or for item 1, /ccc/000.jpg
Substituting this into the code:
Popen(['wget', '-O', file, theImg], stdout=PIPE, stderr=STDOUT)
wget silently fails (at each iteration of the loop).
When I turn on -d debugging and register -a log.log , each iteration prints DEBUG output created by Wget 1.13.4 on darwin10.8.0.
When I delete -O and file , the operation is fine.
My question is: Is there a way A) Indicate as -P AND -O in wget (preferred), or
B) Insert a string in -O containing / -characters that do not crash?
Any help would be appreciated.