Error message "Pipe is broken" trying to use Python actvities "Load Python Script" or "Run Python Script"

Hello!

I’ve made a little project in order to use python activities; the pyhton file contains a short script:

import requests
s=requests.get(‘https://www.google.com’)
print(s.text)

But I receive an error message “Pipe is broken”; it seems Studio doesn’t “see” the python module already installed in my computer.
How could I solve this? Could someone help me with this? I found something on the UiPath forum, but it wasn’t clear for me.
I wrote the properties in Python Scope, the library path, the path, the folder; a simple script (print(‘test’)) works, but if I have to import a module, it doesn’t work anymore.

I have not used python activities until now and I am also new in python language.

Thank you for your help!

Regards!

Ruxandra

1 Like

@Ruxandra_Zamfir

For the import to work you need to first do a pip install of the required library in the machine you are using…that is when it can be accessed

Can you please install and then try

And alternately you can use this activity …please try

Cheers

Hello!

As I said, the module is already installed on my machine, but Studio doesn’t “see” it. Yes, I am using “Load python script”, and it is not working.

Could you help me on this part of python code from the documentation you referred to (load python script) - sys.path.append(os.path.dirname(os.path.realpath(file))) ? About “direname” and "…realpath(file)?

If I understand correctly, I should use the script from the documentation, in my python file in order to import the module, do I?

Thank you for your help!
Regards!

Ruxandra

@Ruxandra_Zamfir

If a environment variable is not added for pointing to python installation directory or the script is not in the installation folder then we can use the given script to change the directory from which the script is loaded

This is an inbuilt function in python to get the directory path of the given string

And this is a default function again to get the path properly ehen there are symbols in the path…

The code provided takes the file…or the scropt file provided and will try to extract the path and set it and imports are to be done after this line

Hope this helps

Cheers

Cheers

1 Like

Hello!

It works, thank you for your help!

Regards!

Ruxandra

1 Like

In fact, I found the cause, I had 2 versions of python installed on my computer, 3.8 and 3.10, I set Studio on 3.10, but the installation of the python module automatically went on version 3.8, so the message “pipe is broken” was because there was no module installed on 3.10 (I uninstalled version 3.8).
It works also with “run python script” activity, there is no error for my short script, even without changing the path.
I’ve noted here, maybe someone will need it.
Thank you for your support!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.