How to troubleshoot Python Activity related errors?
Step-A: (Validate the Configuration parameters)
1. Check the Python exe file path location is properly specified in Python Scope properties
2. Check the installed Python version is 64-bit or 32-bit. In case of 32-bit version select x86
3. Specify the Python version installed. It is always better to specify the Python version rather selecting Auto.
1. Instead of using “Run Python Script” activity, use Load Python Script -> Invoke Python Method -> Get Python Object.
2. Remove the Print statements in Python Code
1. If there is any error related to dependency/Package not found, please check if for the specified python instance (Configured in Python Scope) that package is installed. You can check the package is already installed by executing the command “pip install <package-name>” . If it is already installed, it should prompt as “Requirement already satisfied” as below.
2. If you have any python distribution installed in system like Anaconda, it installs packages in its directory only. Check python file you are trying to run from UiPath can be run from the command prompt for the specified installation. If any dependency is missing. install the dependency first.
In most of the cases executing python code from UiPath doesn’t give the proper error,
As Python is an interprited language, every statement is executed separately. Use following code snippet to identify which line is causing the issue:
outF.write("Test line1 added")
Step-E: (Work around)
If using Python activity, you are still getting error though the file can be run successfully from Command Prompt or Python IDLE. Run the python file from Powershell as below: