Utilizing a Try / Catch method for Python Function Error Catching


I am working on an automation program that creates user accounts for a third-party website my company uses. I invoked a python script that checks / pulls AD for the user’s information to move into the website. This portion works perfectly. I am wanting to implement a try/catch block for the python section so if the user Samaccount is not found that it will display a message letting the admin know that it could not find the users account and terminate the program. I have implemented the try catch (pictured below) but it is not displaying the message when a incorrect user is entered. Is what I am trying to do even possible?

Try Block

Catch Block

Finally block

Output I get when it throws the error


In your python code you have to use try catch and catch the error there and pass it as out argument.

From here the exception would tell only that the python code failed with some issue


Hello @jolsen

This exception handling you need to do inside Python script and need to return a value to the python object based on the account find or not. Then in the UiPath flow, you can make a comparision of the value received in the Python object and then send a notification.