logexample.py logs over the network using logging.handlers.DatagramHandler, which pickles(protocol 1) the data it sends.
logserver.py is supposed to unpickle and print to screen, but instead it raises an error. If I use pickle.loads then KeyError: '\x00' and if I use cPickle.loads its an EOFError
The files are here - http://gist.github.com/542543
Python version 2.6.5
Why is this happening?
--------------------------THE FIX---------------------------
For anyone else who might be interested, here is the fixed handler
class LogHandler(SocketServer.BaseRequestHandler):
def handle(self):
data = self.request[0]
socket = self.request[1]
out = pickle.loads(data[4:])
record = logging.makeLogRecord(out)
print record.msg