Get Python Object throwing an error about maxReceivedMessageSize 65536


I am having some trouble with Python, specifically the Get Python Object activity. My business case is to read a large amount of data using a python script, then input it from the script to UiPath as JSON. However, there seems to be a limitation to what the Get Python Object activity can handle. It keeps throwing an error about message size quota for incoming messages, and the limit being 65536. I know that my data JSON string is longer than 65536. Anything I could do or a setting I could change to allow longer strings to pass through?

I already took a look at WCF maxReceivedMessageSize, but for Python I did not manage to find the setting.

Below is the detailed stack trace.

Stack trace

Error casting Python object: 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. —> 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.GetObject`1.Execute(CodeActivityContext context)

You can divide the Output and write it to multiple text files.
Use Uipath to Read that text file.

Thank you for your advice! Though, while this is a valid workaround, and I certainly will try it, I was hoping there would be a bit more robust solution to this problem.


Did you find any solution to handle this error?



I used the advice in earlier posts. Within the Python code, I write the output it would give, to a text file, instead of passing it straight out from the code. So I then pass the path of the file back to UiPath, and then read the text file in UiPath.

I hope that makes sense. It’s a workaround, but it does work robustly enough.

Thanks tuokyh,

Implemented similar workaround.