Error in invoking python code: "pipeline is broken"

Hi all,

I have received help to develop a python script which is used to extract information from a pdf file. The python code runs fine when run from cmd, but does not function properly when run from UiPath activities.

This is the python code:

def test(file_path):
from biokraft import app
import os

file_type = "xxx"
return_type = "json"

parsed = app.parse(
    file_path=file_path, file_type=file_type, return_type=return_type
)

return parsed

If I just input some random pdf, it will run through the process and give empty values:
But if I actually input the correct file for which I want to extract the information, I would get the following error:

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.Dispose(Boolean disposing)
at System.IO.TextWriter.Dispose()
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)

Anyone know how to proceed here? Please advise

Hi @henry.wang

Check the below thread

Regards

I am using Python 3.9 for this, so it’s not a version issue

Hi @henry.wang

Try checking the below threads:

Regards

I’ve already tried those solutions, none of them seems to work. Any other suggestions?

@henry.wang

  1. Just to check if issue with python can you run any dummy python sequence and check
  2. Is it failing on running only?

Cheers

Hi Anil. Yes the python code runs fine from cmd. It’s failing on running only.

@henry.wang

Did you run a small code to check if that is working?

Also as next steps check the event viewer logs to understand if there is an issue

event viewer logs will have more info about the pipe broken error

cheers