I was wondering if someone experienced this error before. 
I tried to check if the descriptor is a  repeated scalar fields and convert 
to a list by
 changing the new_element to a list but it did not work. 

I appreciate your time and thoughtful consideration.
On Thursday, November 16, 2023 at 12:39:58 PM UTC priya_cast_23 wrote:

> I am trying to parallelize a protobuf application 
> one instance in each thread but I am getting this error 
>
> /usr/local/lib/python3.10/dist-packages/google/protobuf/internal/containers.py",
>  
> line 250, in __reduce__
>     raise pickle.PickleError("Can't pickle repeated scalar fields, convert 
> to list first")
>
> I compiled protobuf 
> ./configure CPPFLAGS="-DGOOGLE_PROTOBUF_NO_THREAD_SAFETY"
>
>   def __reduce__(self, **kwargs) -> NoReturn:
>     # Convert repeated scalar fields to lists
>     raise pickle.PickleError("Can't pickle repeated scalar fields, convert 
> to list first") 
>
>
>   def add(self, **kwargs: Any) -> _T:
>     """Adds a new element at the end of the list and returns it. Keyword
>     arguments may be used to initialize the element.
>     """
>     new_element = self._message_descriptor._concrete_class(**kwargs)
>     new_element._SetListener(self._message_listener)
>     self._values.append(new_element)
>     if not self._message_listener.dirty:
>       self._message_listener.Modified()
>     return new_element
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/43f80425-87f4-40e6-b024-6eed11694809n%40googlegroups.com.

Reply via email to