Run python Script activity does not work

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

Hi @BogdanTod thanks for your reply :slight_smile:

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

Couls you please try this solution for windows projects?

Remove the

if __name__ == "__main__":