0

I am attempting to use a list of output files to merge them into one single file. I need to use a list to store these different files but when I call the rebot function using the list I get the following error,

[ ERROR ] Reading XML source '<in-memory file>' failed: TypeError: expected str, bytes or os.PathLike object, not list

I have tried converting the list to a string value but that will read the list as one long string, which is not what I want. Does anyone know how I can use a list and the rebot function? Here is my example code:

import robot
list_1 = ["output1.xml", "output2.xml"]
robot.rebot(list_1)

2 Answers 2

3

I was able to find a simple solution by using robot.rebot_cli() instead of robot.rebot(). The answer to my example code shown above is as follows. Also, (a side note) running rebot_cli will terminate the program once it is finished merging the files together. To prevent this from happening I included exit=False :

import robot
list_1 = ["output1.xml", "output2.xml"]
robot.rebot_cli(list_1,exit=False)
Sign up to request clarification or add additional context in comments.

Comments

0

From the Robot Framework API guide for Rebot the following example is given for this particular question:

from robot import rebot

with open('stdout.txt', 'w') as stdout:
    rebot('o1.xml', 'o2.xml', name='Example', log=None, stdout=stdout)

2 Comments

I'm sorry, I don't see how this helps. You are still listing the different .xml files out one by one. I need a way to call them from a list, rather than just typing them in individually.
The rebot command takes them as two arguments. If you want to wrap with another function that takes a 2-item list and splits it into the rebot argument 1 and 2, shouldn't be too difficult.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.