Python Forum

Full Version: continue if 'subprocess.call' failes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I do not want to overuse my welcome but it seems the code still hangs up if encounter a 'bad' host.
I waited for a 20sec or mote and then hit 'enter'
after that it prints out:
'Server 'Someserver' took too long to mount. Skipping...'

I changed the timeout from 10 to 2 sec but it changed nothing, it just hangs up...

Thank you guys!
I changed 'capture_output=False':
'subprocess.run("net use U: "+"\\\\"+itm+"\\c$\\SMTS\\TDR_Logs", shell=True, timeout=2, capture_output=False)'
and removed 'break'
except subprocess.TimeoutExpired:
    print(f"Server {itm} took too long to mount.  Skipping...")
and it seems fixed the problem.

Thank you for helping me with this!
Pages: 1 2