Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Return list values from Python Script using Robot Framework custom Keyword

I have created a Robot Framework custom keyword in a python script that returns the full file paths of files in a directory structure. I can run the python script separately and I get the expected results, however, when I use the script as a custom keyword the returned list in empty.

Any help is appreciated See below for code: ROBOT CODE

Settings 
Library  FilePaths.py

Test Cases

GetsubmissionFiles

  @{List}=  get filepaths  ////SomeServer//D//TestData//Automation//UK//

Here is the python code:

import os
class  FilePaths:
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'

d = "\\\\SomeServer\\D\\TestData\\Automation\\UK\\"

def get_filepaths(d):

    file_paths = []  
    for root, directories, files in os.walk(d):
        for filename in files:
            filepath = os.path.join(root, filename)
            file_paths.append(filepath)
    return file_paths

full_file_paths = get_filepaths(d)

print(full_file_paths)

Issue is Robot Framework results in an empty list value with none of the file paths Return value = []

Comments