python rsync script, translated from a previous bash script, except error handling not working