dorna2-python icon indicating copy to clipboard operation
dorna2-python copied to clipboard

Outdated documentation

Open SebastianOlthuis opened this issue 3 months ago • 0 comments

Please update the documentation if changing implemented API features, your documentation in your wiki and GitHub says this :

#Here are two examples, on how to run a script file multiple times using a simple loop:

# case 1: run an script 10 times
for i in range(10):
    robot.play_script(script_path="test.txt")
    robot.log("Script is completed")

Apparently, it changed to (got this by looking into the dorna file from the API) :

    def play_script(self, file="", timeout=-1):
        try:
            with open(file, 'r') as f:
                lines = f.readlines()
                for l in lines:
                    try:
                        self.play(timeout=0, msg=l)
                    except Exception as ex:
                        self.log(ex)
        except Exception as ex:
            self.log(ex)

        return self.sleep(0, timeout=timeout)

So now it only works if you do this:

result = robot.play_script(file="/path")

If using the old way users get this error if they for some reason update there api :

Traceback (most recent call last):
  File "/Pythonscript", line X, in <module>
    result = robot.play_script(script_path="/Path")
TypeError: play_script() got an unexpected keyword argument 'script_path'

SebastianOlthuis avatar Mar 19 '24 12:03 SebastianOlthuis