A Pyro4 server running on 32bit Windows machine is serving numpy image data as a string using img.tostring()
, the dtype
reported before conversion is int32
.
The server code looks like:
def getLastPhase(self):
print("Sending the data now: ")
print( self.lastPhase.dtype )
return self.lastPhase.tostring()
The client code looks like:
data = getLastPhase()
The data is received on a Linux machine with len( data )
= 4177920 or precisely the size of the image in bytes (1024x1020 x4).
However, using fromstring( data, dtype='int32' )
results in exception:
ValueError: string size must be a multiple of element size
If int16
is used instead of int32
no exception is raised but the data is nonsense.
Why is this exception raised in the case where string size matches my data size and not raised in the int16 case?
Is there a difference between string
in Python under Windows and Linux?
Any ideas on how to overcome this problem will be much appreciated.
Edit: the python version on the Windows machine is 2.7, whereas on the Linux it is 3.6