automation - How can I call exceptions or functions instantaneously in Python program execution? -
i have application automated through python script. application may hang or crash anytime unknowingly. hence need write exception or function handle same.
i have call exception or function if running in background , should revoked whenever crash or hang happens.
for ex: consider python script doing automation on application. doing following...
- open application
- browse on icon
- clicks on icon
- select file
- upload file
- close application
during of these steps, crash or hang may occur in application , have different "function/ method" each of steps. how invoke exception @ every steps.
i know easy in java like: public void openapp() throws crashexception, errorexception {
but don't know how same in python. please me same.
1)you can see here built-in exceptions in python.
2)this post examines differences between python , java regarding exception handling.
3)for simple exception handling in python taken here:
def divide(x, y): try: result = x / y except zerodivisionerror: print "division zero!" else: print "result is", result finally: print "executing clause"
Comments
Post a Comment