Catch Exception | from api

Is it possible to catch Test suit exception/error from API (In which no output.xml file is generated)?

@René @aaltat any suggestions?

Could you explain what problem you are trying to solve?

Thanks for the response! I am writing a python script to run a given robot testcase passed as an argument. Also, variables files will be passed as an argument. Your help will be appreciable.

Writing a script is pretty normal, but doesn’t not explain what problem you are trying to solve. Could you share some light on the problem?

So, in the script, if I am writing the following line.

from robot import run

And, if lets say the file path is wrong then run is not giving any error. I want to catch such exceptions.

It should return error code which should be same as in here

But checking missing file is easier by using Python

Hi @aaltat thanks for redirecting me to the links.
This is just one type of exception which I gave as an example. I want to catch all such exceptions.

When I am running the testcase file on command-line interface.

robot path/testcase.robot

That time it is giving me the correct error that that file-path is wrong.
But, when I am using script what I am getting is the error code through which it is really difficult to guess what is exactly wrong. I want to print the exact error that file path is wrong.

Any suggestions on what should I do?

Not really good ones, for me the easiest way is to look what robot framework outputs say.

But what about the cases in which the ‘output.xml’ is not generated like the one I mentioned (file path is wrong).

I have found that the log messages printed in the console are pretty good and usually explains what goes wrong.

I am writing a script and is using for running the tests.

from robot import run

How can I get the log message in such case if something fails let’s say for example file path is not a valid one?