# Invoke Python Method: Pipe is broken

**URL:** <https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780>\
**Category:** Activities\
**Tags:** python, activities\
**Created:** [Eylül 1, 2021, 3:14ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780 "2021-09-01T15:14:03Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![jeevith](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jeevith/32/288449_2.png) [@jeevith](https://forum.uipath.com/u/jeevith)\
**Post date:** [Şubat 22, 2023, 3:47ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/21 "2023-02-22T15:47:42Z")

</div>

Hi @amithvs,

I have wasted a lot of hours as I said before trying to understand Pipe is broken error and I have chosen to move away from the Python Scope Activity. My other two fallbacks are Invoke PowerShell Activity and Start Process Activity. Sadly the Invoke PowerShell activity is currently broken in Windows projects ([UiPath Community 2022.12 Release - #41 by jeevith](https://forum.uipath.com/t/uipath-community-2022-12-release/500258/41))

So the Start Process activity is the only option I can see working using standard UiPath activities. It has a way to call a command asynchronously or synchronously, which is great. Meaning we can let the Start Process complete the command and only then will the other activities in the sequence carry on.

1. Start Process (python script and its arguments → save to a .csv)
2. Read the csv file in UiPath
3. If needed delete the csv as a cleanup

Here is requirements.txt file :  
[requirements.txt](https://forum.uipath.com/uploads/short-url/oWPgEtbtoN22crY0f6D8wv79Wtr.txt) (646 Bytes)  
(you can install all of the dependencies to your system python installation by using `pip install -r requirements.txt`)

The Start Process activity uses Windows Command Prompt to execute the script and uses the python path from environment variables.

My implementation looks like this using [Polars](https://pola-rs.github.io/polars-book/user-guide/coming_from_pandas.html)

```auto
import polars as pl
from fuzzywuzzy import fuzz
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("ThresholdValue", help="The threshold similarity value to be checked", type=str)
parser.add_argument("Input1", help="The first excel file path", type=str)
parser.add_argument("SheetName1", help="The sheet name for Input1", type=str)
parser.add_argument("Input2", help="The second excel file path", type=str)
parser.add_argument("SheetName2", help="The sheet name for Input2", type=str)
args = parser.parse_args()

# Helper functions
def ReadData(FilePath:str, SheetName:str): 
    datatable = pl.read_excel(file=FilePath, sheet_name=SheetName)
    return datatable

def FuzzRatio(FirstName,AliasName):
    ratio = fuzz.ratio(FirstName,AliasName)
    return ratio

def CheckThreshold(SimilarityValue, ThresholdValue):
    return int(SimilarityValue) > ThresholdValue
    

# Polars dataframe queries
def CalculateSimilarity(dataF)-> pl.DataFrame:
    """
    Calculate the similarity ratio and return a dataframe
    """
    result = dataF.with_columns( [
        pl.struct(["First Name", "NameAlias_WholeName"])
        .apply(lambda x: FuzzRatio(x["First Name"], x["NameAlias_WholeName"])).alias("StringSimilarity")])
    return result

def FilterRows(dataF, Thresholdvalue)-> pl.DataFrame:
    """
    Filter data rows where the similarity is over the threshold 
    """
    result = dataF.with_columns([
        pl.struct(["StringSimilarity"])
        .apply(lambda x: CheckThreshold(x["StringSimilarity"], Thresholdvalue)).alias("OverThreshold")])
    result = result.filter(
        (pl.col("OverThreshold") == True))
    return result

def ProcessData(DataF:pl.DataFrame, Thresholdvalue:int)->pl.DataFrame:
    """
    Performs all tasks in the pipeline and return json string
    """                   
    ProcessPipeline = (DataF
    .pipe(CalculateSimilarity)
    .pipe(FilterRows, Thresholdvalue)
    )
    return ProcessPipeline

if __name__ == " __main__":
    # Ingest Data
    input1 = ReadData(args.Input1, args.SheetName1 )
    input2 = ReadData(args.Input2, args.SheetName2)
    CombinedInput_dataframe = pl.concat([input1,input2,],how="horizontal")
    
    resultdf = ProcessData(CombinedInput_dataframe, int(args.ThresholdValue))
    resultdf.write_csv("result.csv") # this csv can be later accessed by UiPath

```

Here is the project folder [PolarsDataframeinUiPath.zip](https://forum.uipath.com/uploads/short-url/jb0C60GiXfFtaeJiwX2bE6QSzXn.zip) (13.4 KB)

 ![image](https://global.discourse-cdn.com/uipath/original/4X/f/f/a/ffab70163f80924ff06ca1df837451fe8ee5a9d9.png)

---

<div class="post-metadata">

**Author:** ![amithvs](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/amithvs/32/10960_2.png) [@amithvs](https://forum.uipath.com/u/amithvs)\
**Post date:** [Şubat 22, 2023, 4:17ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/22 "2023-02-22T16:17:05Z")

</div>

Thanks for the detailed explanation. Much appreciated! I will go through it.

I was also working with fuzzywuzzy, as it was giving better results compared to others. Only difference is I was using **fuzz.token\_sort\_ratio** to get the simmilarity ratio. This method was giving me the desired results.

Great work! Thanks a lot for your effort. Apologies, if I made you waste time on this.

---

<div class="post-metadata">

**Author:** ![jeevith](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jeevith/32/288449_2.png) [@jeevith](https://forum.uipath.com/u/jeevith)\
**Post date:** [Şubat 22, 2023, 4:28ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/23 "2023-02-22T16:28:00Z")

</div>

> [@amithvs](#):
>
> Apologies, if I made you waste time on this.

Definitely not. Was motivated to learn Polars so thank you!

---

<div class="post-metadata">

**Author:** ![gru](https://avatars.discourse-cdn.com/v4/letter/g/49beb7/32.png) [@gru](https://forum.uipath.com/u/gru)\
**Post date:** [Mart 29, 2023, 12:13öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/24 "2023-03-29T00:13:13Z")

</div>

I was facing the same issue. I fixed it by following the below steps:

1. In the “Invoke Python Method” pass the InputParameters as: New List(Of Object) ({string variable}). Example: New List (Of Object) ({text}) where text is the string variable
2. Refer the below merged screenshots  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/3/1/b/31b6278731455d71909d094a745a6823b99e2daf.png)

---

<div class="post-metadata">

**Author:** ![juho.harme](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/juho.harme/32/177044_2.png) [@juho.harme](https://forum.uipath.com/u/juho.harme)\
**Post date:** [Nisan 6, 2023, 11:15öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/25 "2023-04-06T11:15:36Z")

</div>

One possible reason for a “Pipe is broken” error which no-one else seems to have mentioned is a missing library in the python runtime environment. When trying to fix a Python Scope hanging up error, I changed the python.exe file used to run the code, and forgot to switch it back. This resulted in a “pipe is broken” error once the scope would again execute (with .NET 5.0 runtime). I am guessing if you are relying on a lot of libraries in the python code, it may be you are missing one on the computer trying to execute the code. I think it should give a more informative error message, but at least in Python Activities 1.4 you get just “Pipe is broken”.

---

<div class="post-metadata">

**Author:** ![avasiliu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/avasiliu/32/179393_2.png) [@avasiliu](https://forum.uipath.com/u/avasiliu)\
**Post date:** [Mayıs 3, 2023, 8:04öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/26 "2023-05-03T08:04:00Z")

</div>

Hello, I would like to add to this that, from my observations, whenever the Python script encounters an unhandled exception where it would terminate the flow, it would also trigger the UiPath Pipe is Broken error. I have noticed that, if you watch the immediate panel at the $exception variable it does show one layer of the Python error:

```auto
RemoteException wrapping System.AggregateException: One or more errors occurred. ---> RemoteException wrapping System.InvalidOperationException: Error invoking Python method ---> RemoteException wrapping System.InvalidOperationException: Python instantiation exception
Python Invoker program exception:
TypeError : can only concatenate str (not "AttributeError") to str

```

However, if you would try to extract it via the UiPath Try-Catch block, you would simply get this message.  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/7/0/1709fb330c3ebc0589eedb9391dca39a954eaae9.png)  
This is the Catch workflow:

 ![image](https://global.discourse-cdn.com/uipath/original/4X/7/6/b/76b91691dfea4b2400bd55ba7ef2a537e7088591.png)

My question would then be, is there a reliable way to pull the actual unhandled error from inside the Py script, instead of the Pipe is broken message?

---

<div class="post-metadata">

**Author:** ![Devbrath\_Rajkhua](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/devbrath_rajkhua/32/89299_2.png) [@Devbrath\_Rajkhua](https://forum.uipath.com/u/Devbrath_Rajkhua)\
**Post date:** [Haziran 7, 2023, 3:34ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/27 "2023-06-07T15:34:10Z")

</div>

Hi Guys,

Might be late to this thread but even I faced the same issue. I was able to resolve this by lowering the python package ver to 1.3.0. Thought to share this here, might help someone in the future.

Cheers Dev

---

<div class="post-metadata">

**Author:** ![Bh\_P](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Bh\_P](https://forum.uipath.com/u/Bh_P)\
**Post date:** [Haziran 12, 2023, 5:36öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/28 "2023-06-12T05:36:08Z")

</div>

hi @jeevith , could you plz help me to solve issue related to run python in UiPath as i am facing many challenges to do that since long time . thx in advance

---

<div class="post-metadata">

**Author:** ![jeevith](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jeevith/32/288449_2.png) [@jeevith](https://forum.uipath.com/u/jeevith)\
**Post date:** [Haziran 13, 2023, 6:51öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/29 "2023-06-13T06:51:24Z")

</div>

Hi @Bh_P,

You could write about your hurdle in a new post and the forum members /I can probably help you out.

Without understanding what your hurdle is, we can’t help much.

---

<div class="post-metadata">

**Author:** ![pawanrajpurohit](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pawanrajpurohit/32/176783_2.png) [@pawanrajpurohit](https://forum.uipath.com/u/pawanrajpurohit)\
**Post date:** [Haziran 29, 2023, 6:50öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/30 "2023-06-29T06:50:43Z")

</div>

Could you follow this link I provided this issue solution here [Can't run python script uipath - #5 by pawanrajpurohit](https://forum.uipath.com/t/cant-run-python-script-uipath/522740/5)

---

<div class="post-metadata">

**Author:** ![Bilal\_Zafri1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bilal_zafri1/32/280731_2.png) [@Bilal\_Zafri1](https://forum.uipath.com/u/Bilal_Zafri1)\
**Post date:** [Temmuz 23, 2023, 9:29öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/31 "2023-07-23T09:29:05Z")

</div>

> [@Python Integration (Pipe is broken)](https://forum.uipath.com/t/python-integration-pipe-is-broken/418196/16):
>
> The issue generally comes when UiPath is unable to find the required library, below are the steps you can follow to confirm and fix it. Go to the script location where your Python script is present. Open CMD at that particular location. Run your Python script using cmd. If it gives the module not found an error, install it again in that location using cmd and verify again. Hope this help!

---

<div class="post-metadata">

**Author:** ![Rohit\_Jere](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rohit_jere/32/400367_2.png) [@Rohit\_Jere](https://forum.uipath.com/u/Rohit_Jere)\
**Post date:** [Ağustos 17, 2023, 5:12öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/32 "2023-08-17T05:12:19Z")

</div>

I was receving same issue for one of my python code.  
I resolved this by giving path of my python exe installed in Anaconda env and downgrade the python package version to 1.3

 ![image](https://global.discourse-cdn.com/uipath/original/4X/c/a/c/caca1773b76debf12b32493699424aad19c2a6f9.png)

---

<div class="post-metadata">

**Author:** ![chris.shanor](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/chris.shanor/32/176728_2.png) [@chris.shanor](https://forum.uipath.com/u/chris.shanor)\
**Post date:** [Ağustos 17, 2023, 12:19ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/33 "2023-08-17T12:19:42Z")

</div>

Pipe is broken can be caused by anything wrong in the python. To figure out the problem, I run the script from command prompt, feeding it the same arguments (if any) that UiPath sends it.

One time a simple “sys.exit()” statement caused Pipe is broken.

---

<div class="post-metadata">

**Author:** ![TheCraftyCoder](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/thecraftycoder/32/176864_2.png) [@TheCraftyCoder](https://forum.uipath.com/u/TheCraftyCoder)\
**Post date:** [Aralık 8, 2023, 6:36ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/34 "2023-12-08T18:36:37Z")

</div>

This seems like they broke something in the newer packages. I have a script I was testing invoking from UiPath running on Python 3.8. Just running the file outside of UiPath worked fine. I first tried the newest package 1.7.1 which was giving me the pipe error no matter what I did. Per some comments in this thread I downgraded to 1.3.0 and that invoked successfully.

---

<div class="post-metadata">

**Author:** ![loginerror](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/loginerror/32/22614_2.png) [@loginerror](https://forum.uipath.com/u/loginerror)\
**Post date:** [Aralık 18, 2023, 4:28ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/35 "2023-12-18T16:28:25Z")

</div>

Hi @TheCraftyCoder

Could you please share a minimum version of the script that is causing this issue for you?

---

<div class="post-metadata">

**Author:** ![pikut](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pikut/32/498264_2.png) [@pikut](https://forum.uipath.com/u/pikut)\
**Post date:** [Ocak 15, 2024, 6:48öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/36 "2024-01-15T06:48:34Z")

</div>

Are you manually install 1.3.0 version for Python Packages? In Studio version 23.10, minimal version is 1.4.1.

EDIT:

> **[workflow - UiPath.Python.Activities 1.3.0 | MyGet](https://mail.myget.org/feed/workflow/package/nuget/UiPath.Python.Activities/1.3.0)**
>
> MyGet - Hosting your NuGet, npm, Bower, Maven, PHP Composer, Vsix, Python, and Ruby Gems packages

---

<div class="post-metadata">

**Author:** ![loginerror](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/loginerror/32/22614_2.png) [@loginerror](https://forum.uipath.com/u/loginerror)\
**Post date:** [Mart 21, 2024, 12:43ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/37 "2024-03-21T12:43:11Z")

</div>

Just to make sure, I’ve just tried a simple script with Python 3.9.13 and the Python 1.8.0 activity package and it works as expected.

You can always check with this sample project:  
[Sample Python 3.9 project.zip](https://forum.uipath.com/uploads/short-url/Ajt7YOCAj6DC1iWRLBsUwF7mKWM.zip) (10.9 KB)

---

<div class="post-metadata">

**Author:** ![Sanket\_Tidke](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sanket_tidke/32/433350_2.png) [@Sanket\_Tidke](https://forum.uipath.com/u/Sanket_Tidke)\
**Post date:** [Şubat 14, 2025, 8:39öö UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/38 "2025-02-14T08:39:24Z")

</div>

Hi, I was facing the same error in UiPath: Pipe is broken.

FYI,

I have used “log message” after the “load python script” activity and it ran successfully. I don’t know how is this happened but yeah this is the resolution for my

---

<div class="post-metadata">

**Author:** ![loginerror](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/loginerror/32/22614_2.png) [@loginerror](https://forum.uipath.com/u/loginerror)\
**Post date:** [Nisan 7, 2025, 12:14ös UTC](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780/39 "2025-04-07T12:14:02Z")

</div>

We released the UiPath.Python.Activities 1.10.0, which should address the “Pipe is broken” error by actually surfacing the underlying Python exception (among other fixes).

You can read more about it here:

> [@UiPath.Python.Activities 1.10.0 now supports Python 3.13](https://forum.uipath.com/t/uipath-python-activities-1-10-0-now-supports-python-3-13/2779862):
>
> UiPath.Python.Activities 1.10.0 now supports Python 3.13 We have released a new Python activities package version that includes two major improvements to make your life much easier when running your Python scripts. We carefully examined the feedback [after the previous release](https://forum.uipath.com/t/uipath-python-activities-1-9-0-now-supports-the-net-8-desktop-runtime/785069) to make everyone’s life much easier. Changes Also available via the official release notes [over here](https://docs.uipath.com/activities/other/latest/developer/release-notes-python-activities#v1100). Added support for Python 3.13 The activities will now work with the Python version 3.13. Better error handling We imp…

It is now available on the official UiPath feed. Please test it out and let us know if it helps!

[Önceki sayfa](https://forum.uipath.com/t/invoke-python-method-pipe-is-broken/341780.md?page=1)
