I was working on a python application where the client sends a synchronization signal to the server and the server responds with a beep.
I have two buttons: one to start the clock and one to pause the track.
Main class
# function I call when I hit the play button def play(self): start_song = [250] global IS_FIRST_PLAY if IS_FIRST_PLAY: IS_FIRST_PLAY = False self.startClock() if IS_CONNECTED: client.sendMessage(start_song)
Customer class
# this is the client.sendMessage() function def sendMessage(self, message): self.s.sendall(pickle.dumps(message))
Server class
Everything works fine, except for the occasional moment when I change the pause to play, I keep getting this error:
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/socketserver.py", line 306, in _handle_request_noblock self.process_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/socketserver.py", line 332, in process_request self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/socketserver.py", line 345, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/socketserver.py", line 666, in __init__ self.handle() File "/Users/cedricgeerinckx/Dropbox/Redux/OSX/Server.py", line 85, in handle self.data = pickle.loads(self.request.recv(12).strip()) _pickle.UnpicklingError: unpickling stack underflow
What could be this problem?
source share