Python Forum
Python error handling Paramiko
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python error handling Paramiko
#2
If you're getting an error, and want to handle it safely, then you're looking for exception handling: https://docs.python.org/3/tutorial/errors.html

>>> def i_always_fail():
...   print("here we go!")
...   raise Exception("dead")
...
>>> i_always_fail()
here we go!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in i_always_fail
Exception: dead
>>> try:
...   i_always_fail()
... except Exception as err:
...   print("Error happened: {}".format(err))
...
here we go!
Error happened: dead
Reply


Messages In This Thread
Python error handling Paramiko - by pythondiy - Aug-18-2017, 03:29 PM
RE: Python error handling Paramiko - by nilamo - Aug-18-2017, 04:39 PM
RE: Python error handling Paramiko - by oldseven - Aug-22-2017, 02:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Paramiko Server -- Exception (server): Error reading SSH protocol banner ujlain 3 4,832 Jul-24-2023, 06:52 AM
Last Post: Gribouillis
  Paramiko resource shortage error michu7 0 2,909 Apr-10-2020, 04:04 PM
Last Post: michu7
  Python Paramiko, continuing the interaction for a command in interactive shell aditya_g01 0 8,788 Mar-13-2018, 04:51 AM
Last Post: aditya_g01
  How to keep paramiko ssh session open after loggin in using python? MikeHill 3 13,652 Aug-15-2017, 06:55 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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