Python code Orchestration

Hi, I’m fairly new to Robocorp (RPA Framework) syntax and I’d rather write all automations with Python. Is there a way to write, deploy and orchestrate Python files in Robocorp?

Hi, @micholewski! Great question.

The answer is yes. We’ll probably write a proper article about this, but this should get you started:

  • I created a new robot with the minimal template.
  • I deleted the tasks.robot file, since I won’t be using that.
  • I created a new Python file. I decide to call it tasks.py.

The dir looks like this:

output
conda.yaml
robot.yaml
tasks.py
  • I modified the robot.yaml like this, changing the command to run python using the tasks.py as the target:
tasks:
  entrypoint:
    command:
      - python
      - tasks.py

condaConfigFile: conda.yaml
artifactsDir: output
ignoreFiles:
  - .gitignore
PATH:
  - .
PYTHONPATH:
  - .
  • I created a simple web robot in the tasks.py file:
from RPA.Browser import Browser


browser = Browser()
browser.open_available_browser("https://robocorp.com/docs/")
browser.input_text("css:input", "python")
browser.press_keys("css:input", "ENTER")
browser.screenshot(filename="output/screenshot.png")
browser.close_all_browsers()

That works also in Robocorp Cloud.

Give it a try and tell how it goes!

// Jani

3 Likes

Awesome, thanks you very much!

1 Like

Thanks for the inspiration! We now have a simple article about this available:

1 Like