-
Notifications
You must be signed in to change notification settings - Fork 491
except exception? #508
Copy link
Copy link
Closed
Description
I've created this function
def cre_file_conn(ip_addr,username,priv_keys):
try:
cmd = ("ssh -i {} {}{}{}").format(priv_keys,username,"@",ip_addr)
child = pexpect.spawn(cmd)
child.expect(username)
child.sendline('touch 123toto.txt')
child.expect(username)
child.sendline('exit')
except Exception as e:
print(str(e)) The except Exception as e works well. But I was not able to find the mention on the docs.
What is the difference between except Exception as e and except pexpect.EOF as e?
I know that except pexpect.EOF as e will try to catch all EOF. But how about except Exception?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels