Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Executing a Python File from Robot Framework using Process Library

I am trying to execute a python file from Robot Framework using the Process Library as follows:

Example Test Case
    OperatingSystem.Should Exist    ${CURDIR}/../../../../../server.py
    Start Process    python.exe ${CURDIR}/../../../../../server.py    alias=PythonServer

The OperatingSystem.Should Exist is passing but the Start Process line is failing. I am getting the error:
FileNotFoundError: [WinError 2] The system cannot find the file specified

I have also tried giving the absolute path following python.exe but that also is giving the same error.
I have also tried giving the absolute path of my python.exe

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

What is the right syntax to execute a python file from Robot Framework using the Process Library?

>Solution :

You missed the separation of the program and its arguments.

Here is an example:

*** Settings ***
Library           Process
Library           OperatingSystem

*** Test Cases ***
Example Test Case
    OperatingSystem.Should Exist    ${CURDIR}/../wx_html_image.py
    Start Process    python    ${CURDIR}/../wx_html_image.py    alias=PythonServer

As you can see on the Start Process documentation, the *arguments are separated:
RIDE Text Editor with Test Case and Start Process doc

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading