How to resolve these Unpickling Errors?

19 views Asked by At

List of errors:

Data:  [['Target', 'Hit'], ['Mission', ''], ['Optical/IR', 'Optical'], ['Arm', ''], ['Optical Zoom', 0], ['Digital Zoom', 0], ['Pitch', 0], ['Yaw', 0], ['Reset Camera', 0], ['Target Selection', 0], ['Take Screenshot', 0]]
Data:  [['Target', 'Hit'], ['Mission', ''], ['Optical/IR', 'Optical'], ['Arm', ''], ['Optical Zoom', 0], ['Digital Zoom', 0], ['Pitch', 0], ['Yaw', 0], ['Reset Camera', 0], ['Target Selection', 0], ['Take Screenshot', 0]]
invalid load key, '\x00'.
could not find MARK
unpickling stack underflow
could not find MARK
invalid load key, 'A'.
the STRING opcode argument must be quoted
unpickling stack underflow
could not find MARK
unpickling stack underflow
unpickling stack underflow
could not find MARK
unpickling stack underflow
could not find MARK
could not find MARK
could not find MARK
could not find MARK
invalid load key, '\x00'.
unpickling stack underflow
111
unpickling stack underflow
invalid load key, '\x0f'.
6
'utf-8' codec can't decode byte 0x94 in position 4: invalid start byte
unpickling stack underflow
could not find MARK
unpickling stack underflow
unpickling stack underflow
invalid load key, '\x00'.
invalid load key, '\x00'.
unpickling stack underflow
Data:  [['Target', 'Hit'], ['Mission', ''], ['Optical/IR', 'Optical'], ['Arm', ''], ['Optical Zoom', 0], ['Digital Zoom', 0], ['Pitch', 0], ['Yaw', 0], ['Reset Camera', 0], ['Target Selection', 0], ['Take Screenshot', 0]]
Data:  [['Target', 'Hit'], ['Mission', ''], ['Optical/IR', 'Optical'], ['Arm', ''], ['Optical Zoom', 0], ['Digital Zoom', 0], ['Pitch', 0], ['Yaw', 0], ['Reset Camera', 0], ['Target Selection', 0], ['Take Screenshot', 0]]

The data is received continuously through Socket Stream Here is the code that I have used to read the data from socket:

    def receive_data(self):
        while True:
            try:
                count_bytes=self.client_socket.recv(1024)
                #t=chardet.detect(count_bytes)
                #print(t['encoding'])
                count = pickle.loads(count_bytes)
                print("Data: ", count)
                time.sleep(0.1)
            except Exception as e:
                print(e)

The data sent from the other pc is dumped correctly but I am thinking something is wrong at the receiving end. Can someone please solve this issue and let me know how can I rewrite this code.

The solution given on internet are for file handling. Below should be the continuous output. Data: [['Target', 'Hit'], ['Mission', ''], ['Optical/IR', 'Optical'], ['Arm', ''], ['Optical Zoom', 0], ['Digital Zoom', 0], ['Pitch', 0], ['Yaw', 0], ['Reset Camera', 0], ['Target Selection', 0], ['Take Screenshot', 0]]

0

There are 0 answers