Python Forum
continue if 'subprocess.call' failes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: continue if 'subprocess.call' failes (/thread-34728.html)

Pages: 1 2


RE: continue if 'subprocess.call' failes - tester_V - Aug-26-2021

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!


RE: continue if 'subprocess.call' failes - tester_V - Aug-26-2021

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!