Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

Run Python Script into Process Robotic

Hi,


I would like know how can I run Python script into Process Robot. It includes import some kind library like Numpy or Pandas.


I saw some topics like run Python script using CMD but I would like run Python Script directly on the Process Robot.


Just another question. Should I configure/install Python and the libraries ?


Thanks in advanced


Best Answer

For example, you can create a .py file with the following source code:


# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print b,
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result



Afterwards, within the properties of the "Run Python Script", under the advanced tab, provide the path to that file.


Finally, running the following script, should provide you with a result:


import fibo

fibo.fib(10)



1 person has this question

I also have the same request.

ADMIN

You can run python scripts directly within ProcessRobot by using the action "Run Python Script".


In case you wish to use external libraries, please keep in mind that ProcessRobot uses IronPython and therefore only libraries supported by this implementation can be imported.


In any other case, you could have Python and the desired libraries installed on your machine and run a .py file by using the "Run Application" action.


1 person likes this

Thank you so much Konstantinos !


I didnt know Process Robot uses IronPhyton.


So, how can I configure libraries ? Please , do you have some example ?


Best regards

ADMIN
Answer

For example, you can create a .py file with the following source code:


# Fibonacci numbers module

def fib(n):    # write Fibonacci series up to n
    a, b = 0, 1
    while b < n:
        print b,
        a, b = b, a+b

def fib2(n): # return Fibonacci series up to n
    result = []
    a, b = 0, 1
    while b < n:
        result.append(b)
        a, b = b, a+b
    return result



Afterwards, within the properties of the "Run Python Script", under the advanced tab, provide the path to that file.


Finally, running the following script, should provide you with a result:


import fibo

fibo.fib(10)



1 person likes this

This is a practical feature that will be added to winautomation in the future?

ADMIN

Yes, this feature is in the road map for WinAutomation as well.

Login or Signup to post a comment