Exception - Get Python Object

Anyone here know how to increase the size quota of incoming messages? I am getting the following error when I am trying to retrieve the python object as a string after invoking a python method in UiPath Studio. Or anyone here has faced this issue and has any workaround?

**RemoteException wrapping System.InvalidOperationException: Error converting Python object —> RemoteException wrapping System.ServiceModel.CommunicationException: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota,
use the MaxReceivedMessageSize property on the appropriate binding element. —> RemoteException wrapping System.ServiceModel.QuotaExceededException: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota,
use the MaxReceivedMessageSize property on the appropriate binding element.

--- End of inner exception stack trace ---

Server stack trace:
at System.ServiceModel.Channels.ClientDuplexConnectionReader.DecodeMessage(Byte buffer,
Int32& offset,
Int32& size,
Boolean& isAtEOF,
TimeSpan timeout)
at System.ServiceModel.Channels.SessionConnectionReader.DecodeMessage(TimeSpan timeout)
at System.ServiceModel.Channels.SessionConnectionReader.Receive(TimeSpan timeout)
at System.ServiceModel.Channels.SynchronizedMessageSource.Receive(TimeSpan timeout)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.Receive(TimeSpan timeout)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceive(TimeSpan timeout,
Message& message)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message,
TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway,
ProxyOperationRuntime operation,
Object ins,
Object outs,
TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,
ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,
IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,
Int32 type)
at UiPath.Python.Service.IPythonService.Convert(Guid obj,
String t)
at UiPath.Python.Impl.OutOfProcessEngine.Convert(PythonObject obj,
Type t)
at UiPath.Python.Activities.GetObject1.Execute(CodeActivityContext context) --- End of inner exception stack trace --- at UiPath.Python.Activities.GetObject1.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance,
ActivityExecutor executor,
BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor,
BookmarkManager bookmarkManager,
Location resultLocation)**

Here is the snapshot of my workflow
image
use the MaxReceivedMessageSize property on the appropriate binding element.

Is this python script making an API call internally ? If yes… following below mentioned approach can resolve it.

UiPath.WebActivities.SoapClient sets the maximum acceptable return message size to 65536 bytes, you can create your own client object without the activity and set the maximum limit to a much higher value and successfully run the script. very high level format for the code could be like this…

Dim binding As BasicHttpBinding = New BasicHttpBinding()
binding.MaxReceivedMessageSize = Int32.MaxValue
Dim client As TestOrder.OrderSoapClient =
New TestOrder.OrderSoapClient(
binding, New EndpointAddress(“http://localhost:8088/testOrderSoap”))

I hope you find it helpful.

Thanks for the response @pradeep-shukla. Nope this python script is not making any API call. It’s just reading the excel file, preprocessing the data, converting dataframe as JSON format and returning JSON data as a python object. I am then converting JSON data to data table format. I assume Get Python Object also cannot retrieve anything which is more than 65536 characters?

Although I have developed a work around, I am writing a notepad file using Python script and then retrieving the data using Read Txt activity.

Tell me if there is a better way to do this.