Resource

Updated at:

read

read(resource_name, encoding='utf-8')

Description

Reads the content of a resource file.

Parameters

resource_name <str> The name of the resource file. The path is relative to the resources folder in the project.

encoding <str> The encoding format of the resource file. The default is utf-8.

Return value

The content of the resource file. <str>

Sample Call: rpa.project.resource.read

# Note: Before running this code, confirm that the text file exists in the correct folder under Resources in the project panel.
# The following code is an example. It returns the text content of the file.
content = rpa.project.resource.read('test.txt')

get_path

get_path(resource_name=None)

Description

Retrieves the path of a resource file.

Parameters

resource_name <str> The name of the resource file. The path is relative to the resources folder in the project.

Return value

The absolute path of the resource file. <str>

Call example: rpa.project.resource.get_path

# Note: Before running this code, confirm that the text file exists in the correct folder under Resources in the project panel.
# The following code is an example. It returns the absolute path of the file.
path = rpa.project.resource.get_path(r'file_test\test1.txt')