Help with ioFog Python app


(Francesca Monducci) #1

Hi everyone! I’m trying to deploy two Python microservices. One has to post a message via socket to the other, so I’m using the ioFog Python SDK, but I’m encoutering the following exception:

‘bytearray’ object has no attribute ‘encode’

Which leads to ioMessage’s line 66:

byte_num, byte_num_len = num_to_bytearray(self.sequencenumber)
header.extend(pack(’>B’, byte_num_len))
body.extend(byte_num.encode())

I’m wondering if it has something to do with the num_to_bytearray conversion, because byte_num should already be a byte array, so it shouldn’t need the encoding.


(Serge Radinovich) #2

Can you please confirm which version of the SDK your are using and that you are using Python3?


(Francesca Monducci) #3

I’m using v3.0.0-alpha1 and Python3.


(Serge Radinovich) #4

Can you try removing the .encode() from line 66 and test again?


(Francesca Monducci) #5

I removed all the .encode() when there was a call to num_to_bytearray first and now it works just fine, thank you! :slight_smile:


(Serge Radinovich) #6

I have pushed the fix to develop https://github.com/eclipse-iofog/iofog-python-sdk/commit/9135aee4803ac61dcad234f858d667529f5e2b50

We will release alpha2 in the near future. Thanks!