(15.03.2017, 10:46)admin Wrote: You don't need that strange repeat loop. Wget is blocking, it does not background while downloading so when os.executes return file must be there unless there's an error with connection or file is not found on the remote server.
But I had such situation:
especially when I try download few files and after this I want immediately send them via email. Email was sent but with only a part of images(not fully loaded). Firstly I've added some intuitive os.sleep(n) (intuitive because it depends on size of file and on available bandwith) but after I've prepared this solution which start download an image, check if download is finished and then it returns full-loaded file and its path. When I am using this solution I didn't have some problem with not fully-loaded file sent via email.
But also when I've used Erwin example sometimes I had a problem with not-fully loaded images attached to an email. The solution was adding some os.sleep(n) after os.execute() (normally for camera snapshot 400kB 1-2s).