Python Forum
continue if 'subprocess.call' failes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
continue if 'subprocess.call' failes
#1
Hello!
I'm pulling out logs from remote hosts to my server for processing.
The server has a faceless account and all the Hosts have it added as an admin(admin group).
Sometimes, a new Host has a bad configuration and it asks for UserName...
I thought I can use try/except to keep going if an error or cannot log in...
for some reason, the code just stops with the message:
"The password is invalid for..."
I thought "try/except' will make it keep going but it is not:

try :
	subprocess.call("net use U: /delete /yes")
	time.sleep(1)
	subprocess.call("net use U: "+"\\\\"+itm+"\\c$\\SMTS\\TDR_Logs")
	tr = time.localtime()
	cutr = time.strftime("%Y-%m-%d %I:%M:%S", tr)
	print(f" Dir mounted -->> {cutr} -- {host_path}")            
except OSError as st :
	print(f" Error --> {st}")
	pass

Any idea on how to ignore the message ""The password is invalid for...""?
Thank you!
Reply


Messages In This Thread
continue if 'subprocess.call' failes - by tester_V - Aug-25-2021, 08:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  printing out the contents aftre subprocess.call() Rakshan 3 2,826 Jul-30-2021, 08:27 AM
Last Post: DeaD_EyE
  subprocess call cannot find the file specified RRR 6 16,808 Oct-15-2020, 11:29 AM
Last Post: RRR
  Why wont subprocess call work? steve_shambles 3 2,730 Apr-28-2020, 03:06 PM
Last Post: steve_shambles
  subprocess.call - Help ! sniper6 0 1,555 Nov-27-2019, 07:42 PM
Last Post: sniper6
  Mock call to subprocess.Popen failing with StopIteration tharpa 7 5,997 Nov-08-2019, 05:00 PM
Last Post: Gribouillis
  Echo call to VLC bash using subprocess.Popen on Linux LuukS001 17 9,829 Jan-07-2019, 03:58 AM
Last Post: LuukS001
  Why is subprocess.call command not working? zBernie 5 10,797 Nov-19-2018, 11:11 PM
Last Post: snippsat
  Help with subprocess..call oldcity 1 2,588 Sep-28-2018, 03:59 PM
Last Post: volcano63
  subprocess.call salmaankamil 1 2,745 Jul-27-2018, 06:50 PM
Last Post: woooee
  [inconsistent output] subprocess.call to run cmd commands to get Kerberos ticket Yelin 2 5,060 Jun-08-2018, 09:02 AM
Last Post: Yelin

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020