Run Python Code

Allow calls to&from UI from python

2 Likes

You can call the Orchestrator API and if you dare the Robot API (no support) from any language.
What do you mean by calling Python?

1 Like

Would be good if we can use UiPath tools through an api like python. Is there such a thing?

What tools?

Like badita said, Orchestrator and the Robot have APIs you can use from any language you wish, including python.

Can you share a link on these APIs? I havent seen them. Do they have API’s for python language?

Orchestrator API

1 Like

Thanks for the link Cosin,
However I dont see any python api. Would there be any examples of scripts that are using UiPath API’s

Not sure how to help you. We keep saying that APIs are not language specific, it’s the same API for python, C#, javascript or haskel. Just use it in python like any API

A python SDK would be the best. No more VB or graphical programming.

Why do you need a python SDK?
UiPath’s graphical programming make it easier to do automation.

1 Like

Graphical programming is cluttered and hard to debug. For my application I need to process a lot of data, with many potential exceptions. It would be much easier to script a solution; throwing exceptions, nesting, recursion, functions, state machines, etc. Ask any programmer if they would rather do graphical or text-based programming.

2 Likes

Why can’t you invoke via Powershell or custom activities?

Here are some examples that are calling AutoHotkey or Powershell: https://forum.uipath.com/c/activities. My guess is that you could follow the same approach with Python.

1 Like

Maybe I could use Powershell or custom activities. I haven’t seen any videos or documentation. Is it possible to script something in PS, then make a method call to a GUI recording, while passing variables between PS and the recording?

This could help:

And a wrapper activity with path, args and out result.

2 Likes

I think you can run python code by Powershell…

i m not able to go to that link…pls will u share it again?

Reconsidering. We entered first time in an Orchestrator API discussion.

I am not sure how this is planned to be handled .I had an idea while I was trying to execute some Python code … instead of executing it as a external command , I was able to get IronPython Libraries into .Net. Thorough which I was able to invoke python code pretty efficiently.

From what I have seen , it seems possible to build out a custom activity which would accept a python code - Just like invoke code does at the moment - and its dll , would contain IronPython libs which would help get the python code executed

2 Likes

I was able to build something like this , to invoke one of python files , I feel if we put a wrapper around it , and take the python code as an input , we should be able to get it invoked via IronPython …

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IronPython.Hosting;
using IronPython.Runtime;
using IronPython;
using Microsoft.Scripting.Hosting;

namespace IronPython_Implimentation
{
public class Class1
{
public static void Main(string args)
{
ScriptEngine engine = Python.CreateEngine();

        var result = engine.Execute("2+2");
        System.Diagnostics.Debug.WriteLine("Method1");

        Console.WriteLine(result);
    }


}

}

ref link - https://hasanyavuz.ozderya.net/?p=362

Imagine a world where you manipulate data with Python Pandas! So elegant. So fast.
What if we could import a Python Package and use python instead of VB.Net and take advantage of all the python-libraries available?

Br
Cris

1 Like