# Invoke Python - pipe is broken

**URL:** <https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140>\
**Category:** Studio\
**Tags:** tools, question, studio, python, activities\
**Created:** [January 29, 2022, 3:29am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140 "2022-01-29T03:29:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![timrj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/timrj/32/77942_2.png) [@timrj](https://forum.uipath.com/u/timrj)\
**Post date:** [January 29, 2022, 3:29am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/1 "2022-01-29T03:29:39Z")

</div>

I have searched the forum and have not seen an answer that solves this for me. I have been using invoked python methods (and some existing robots are still working with this method) for a number of years. However, after the last upgrade 2021.10.4 I am getting the error below, generated from the invoke python method activity.

I have tried this on a number of different python code bases to see if it changed the outcome and the summary is:

1. If the python code base invoked is a single function on a single file and does not import another function it works and has no parameters
2. If the python code base invoked is a single file with the called function then invoking other functions in the same file this works even with parameters
3. If the the called function imports a function from another python file, even if it doesn’t use it, the error appears, with or without parameters.

This does not appear to be a file size issue as my test cases are just sending json text back and forth (as I have seen commentary that this error can be caused by large files). And in scenarios 1 and 2 it works so it isn’t my python install or version or scope activity.

Am I missing something, or is this a limitation? For some of my projects I can make it work with a single file with multiple functions but I would prefer not to compromise the python project structures.

Note that the older robots that utilise python fit example 3 and are still working.

To trouble shoot this I have:

- Reinstalled studio
- Reinstalled the python packages
- started a completely new project to test the scenarios above

RemoteException wrapping System.IO.IOException: Pipe is broken.  
at System.IO.Pipes.PipeStream.CheckWriteOperations()  
at System.IO.Pipes.PipeStream.Flush()  
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)  
at System.IO.StreamWriter.set\_AutoFlush(Boolean value)  
at UiPath.Python.Service.PythonProxy.RequestAsync(PythonRequest request, CancellationToken ct)  
at UiPath.Python.Service.PythonProxy.Shutdown()  
at UiPath.Python.Impl.OutOfProcessEngine.Release()  
at UiPath.Python.Activities.PythonScope.Cleanup()  
at UiPath.Python.Activities.PythonScope.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)  
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)  
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

---

<div class="post-metadata">

**Author:** ![Nithinkrishna](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/nithinkrishna/32/561519_2.png) [@Nithinkrishna](https://forum.uipath.com/u/Nithinkrishna)\
**Post date:** [January 29, 2022, 4:27am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/2 "2022-01-29T04:27:38Z")

</div>

Hey @timrj

This looks like python error.

Found this [python - IOError: [Errno 32] Broken pipe when piping: `prog.py | othercmd` - Stack Overflow](https://stackoverflow.com/questions/14207708/ioerror-errno-32-broken-pipe-when-piping-prog-py-othercmd)

May be give it a try.

Thanks  
#nK

---

<div class="post-metadata">

**Author:** ![timrj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/timrj/32/77942_2.png) [@timrj](https://forum.uipath.com/u/timrj)\
**Post date:** [February 6, 2022, 7:55am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/3 "2022-02-06T07:55:39Z")

</div>

Thanks, i had a look and I don’t think it’s a python problem. The scripts that are invoked work fine when run in isolation. It is only when they are invoked by UIPath that the error occurs. I have also got one working by just bringing every code module into the single file but that is not ideal.

I have seen others with the same problem but none seem to have found a solution.

---

<div class="post-metadata">

**Author:** ![shiliqiang](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/shiliqiang/32/263451_2.png) [@shiliqiang](https://forum.uipath.com/u/shiliqiang)\
**Post date:** [February 9, 2022, 7:31am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/4 "2022-02-09T07:31:19Z")

</div>

> [@timrj](#):
>
> n others with the sa

我也是，找了好多都不行

---

<div class="post-metadata">

**Author:** ![ran.an](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ran.an/32/176642_2.png) [@ran.an](https://forum.uipath.com/u/ran.an)\
**Post date:** [February 22, 2022, 10:02pm UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/5 "2022-02-22T22:02:37Z")

</div>

Same issue here, the python code runs perfectly by PyCharm. but cannot invoke inside UiPath.

---

<div class="post-metadata">

**Author:** ![timrj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/timrj/32/77942_2.png) [@timrj](https://forum.uipath.com/u/timrj)\
**Post date:** [February 23, 2022, 5:46am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/6 "2022-02-23T05:46:02Z")

</div>

I even triggered the same python code base from a web app and it all worked with same params and returned data.

---

<div class="post-metadata">

**Author:** ![shiliqiang](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/shiliqiang/32/263451_2.png) [@shiliqiang](https://forum.uipath.com/u/shiliqiang)\
**Post date:** [March 29, 2022, 3:14am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/8 "2022-03-29T03:14:13Z")

</div>

1、Change the Python Version 3.6  
2、Change the uipath.python.activities 1.3

Try it~

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [April 2, 2022, 1:39am UTC](https://forum.uipath.com/t/invoke-python-pipe-is-broken/395140/9 "2022-04-02T01:39:32Z")

</div>

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