Step-A: (Validate the Configuration parameters)
- Check the Python exe file path location is properly specified in Python Scope properties
- Check the installed Python version is 64-bit or 32-bit. In case of 32-bit version select x86
- Specify the Python version installed. It is always better to specify the Python version rather selecting Auto.
- Instead of using " Run Python Script " activity, use Load Python Script -> Invoke Python Method -> Get Python Object .
- Remove the Print statements in Python Code
- 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 " . If it is already installed, it should prompt as “Requirement already satisfied” as below.
- 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: