Python Script package

The Python Script package contains actions that enable Python Script functions in a task.

Before you start

Ensure the following requirements are met before using the Python Script package:
  • The appropriate version of Python is installed on the device on which you want to execute the script.
    Note: Python versions 2.x and 3.x are supported.
  • The "PATH" environment variable is updated to the path of the Python folder.

    To verify if the Python environment variable is set correctly, enter Python in the command prompt. If it returns the Python version that is installed, the path environment is set up correctly.

Perform the following actions within the Python Script package as part of using the set of available actions:

  1. Open a Python Script file, or manually enter the script you want to run using the Open action. You must associate the details of the file or script you want to run with a session name.
  2. Run the script using the Execute function or the Execute script action. You must use the same Python Script session name established in the Open action.
  3. Close the Python Script session after running the script.
Note: When you run a bot that contains Python Script actions, the script runs in the background.

To review the bot launcher logs, navigate to C:\ProgramData\AutomationAnywhere\BotRunner\Logs\<current month>\Bot_Launcher-<today's date>.log.zip. Each zipped folder contains a file with data on the code execution, which is useful for debugging.

Actions in the Python Script package

The Python Script package includes the following actions:
Note: The Open action must be the first action to use the Python Script in a task. These actions can run a Python Script on Windows, Linux, and UNIX-based devices.
Action Description
Close

See Close action.

Execute function

See Execute function action.

For an example, see Example of using Python script to join a list.
Execute script

See Execute script action.

For an example, see Create a PDF using Python script.
Open

See Open action.

More resources