Note: You are looking at a static snapshot of documentation related to Robot Framework automations. The most recent documentation is at https://robocorp.com/docs

Python framework

In addition to Robot Framework, Robocorp supports automating with Python as a first-class experience.

Background

Python as a programming language is a great fit for automation. The syntax is relatively simple and the ecosystem of libraries and guides is vast. However, creating something that is easy to deploy, maintain, and debug afterwards can be a challenge. Additionally, the learning curve can be quite steep and knowing what libraries to choose is not easy either. Robocorp offers a Python framework for automation, which solves the common problems developers face and reduces boilerplate not relevant to the task at hand.

The core of framework is a set of libraries for automating your processes, and it aims to come with batteries included. Some libraries handle specific tasks such as browser automation or document processing, but the framework also reduces developer load by allowing you to turn a small Python snippet into a deployable automation with minimal effort. The advanced logging features of the libraries create easy-to-read reports of what happened and you can quickly see if something went wrong - and how to fix it.

Minimal example

To create runnable portions for a Python project, the robocorp-tasks library defines a @task decorator. It tells the library that the function implements one specific automation task, which can then later be scheduled to run in Control Room. In addition, the decorator automatically initializes logging from robocorp-log.

from robocorp.tasks import task @task def hello(): print("Hello World!")

The above minimum example defines a task, which can then be run with python -m robocorp.tasks. Once execution is finished, you can view the log generated (by default) to a log.html file:

log.html

Further reading

To get started with Python automation, check out our first certification course.

To learn more about specific libraries, see the library documentation section.

Last edit: August 16, 2023