+if False: # Queue pickle error debugging code
+ """The Hooke class is passed back from the CommandEngine process
+ to the main process via a :class:`multiprocessing.queues.Queue`,
+ which uses :mod:`pickle` for serialization. There are a number of
+ objects that are unpicklable, and the error messages are not
+ always helpful. This block of code hooks you into the Queue's
+ _feed method so you can print out useful tidbits to help find the
+ particular object that is gumming up the pickle works.
+ """
+ import multiprocessing.queues
+ import sys
+ feed = multiprocessing.queues.Queue._feed
+ def new_feed (buffer, notempty, send, writelock, close):
+ def s(obj):
+ print 'SEND:', obj, dir(obj)
+ for a in dir(obj):
+ attr = getattr(obj, a)
+ #print ' ', a, attr, type(attr)
+ if obj.__class__.__name__ == 'Hooke':
+ # Set suspect attributes to None until you resolve the
+ # PicklingError. Then fix whatever is breaking the
+ # pickling.
+ #obj.commands = None
+ #obj.drivers = None
+ #obj.plugins = None
+ #obj.ui = None
+ pass
+ sys.stdout.flush()
+ send(obj)
+ feed(buffer, notempty, s, writelock, close)
+ multiprocessing.queues.Queue._feed = staticmethod(new_feed)
+
+import logging
+import logging.config