Depending on the operating system (OS) used for compiling your Python script, your workflows or actions can fail after importing the relevant ZIP archive to the Automation Orchestrator Client.
The OS of the runtime container used for Python in Automation Orchestrator is based on Photon 3.0. Python script packages compiled for another OS, such as Linux for example, are incompatible with the runtime container. This problem can cause the Python script to fail, when you attempt to use it as part of your Automation Orchestrator workflows or actions. In such a scenario, you receive the following error message in your logs:
-04:00errorCannot find module action
To resolve this problem, you must install the required Python package in a Photon OS container folder.
Procedure
- Navigate to the parent folder of your Python script.
- Create a container with the base Photon image by mounting a container folder to your parent folder.
Note: The following script is a singular Docker command that you must run in its entirety to create a suitable container.
docker run -ti -v
$(pwd)/<name_of_folder_that_containes_your_python_script>/:/<name_of_folder_that_containes_your_python_script>
photon:3.0
- Install Python in the container.
tdnf install -y python3-3.7.5-5.ph3 python3-pip-3.7.5-5.ph3
- Navigate to the container folder that includes your Python script.
- Add your Python script and packages.
Note: Install packages required for your Python script in the
lib folder.
pip3 install <package_name> -t lib/
- Exit the container and navigate to the local folder you mounted to the container.
- Compress all relevant files and folders into a ZIP archive.
- Import the ZIP archive into the Automation Orchestrator Client and validate the script by running it as part of an action.