Re_Walter
(Walter Enzo Re)
January 11, 2023, 8:21am
1
Hi guys,
I am trying to execute python code using UiPath.
I saw the demo on python activity: https://docs.uipath.com/activities/docs/invoking-a-python-script , but for what I am supposed to do, this method doesn’t work.
So now I’m trying to use “Run python script activity,” but it doesn’t seem to do anything. It doesn’t throw any errors, but it doesn’t do anything!
This is my workflow:
And this is my code:
if __name__ == "__main__":
f = open('test.txt', 'x')
I am starting with a very simple code, to understand how it works, but when I launch the robot nothing happens. I also tried putting the “load python script” activity before “run python script”, but nothing changed.
Any suggestions? Thank you very much.
Hi @Re_Walter ,
Do you mind checking which python versions do you have installed?
Could you also send a screenshot of the properties panel for “Python Scope” activity?
Regards,
Bogdan
Re_Walter
(Walter Enzo Re)
January 11, 2023, 8:32am
3
Hi @BogdanTod thanks for your reply
This is the screenshot of Python scope activity.
I’m using python 3.10
Hello,
I went through the same problem, I was using a new project in “Windows” mode and I was not successful when using Python.
I created a new project in “Windows-Legacy” mode and it worked perfectly
loginerror
(Maciej Kuźmicz)
February 3, 2023, 2:15pm
5
Couls you please try this solution for windows projects?
I was able to run python code after installing .NET 5.0.17 Desktop Runtime and by providing below settings for Python Scope Activity v1.6.0.
For Python 3.9.16:
Path: “C:\Users\USERNAME\AppData\Local\Programs\Python\Python39”
Working Folder: Working folder of the script.
For Python 3.10:
Library Path: “C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\python310.dll”
Path: “C:\Users\USERNAME\AppData\Local\Programs\Python\Python310”
Working Folder: Working folder of the script.
Remove the
if __name__ == "__main__":