Okay, I figured it out. Since PyOSC is only lightly documented, the source code serves as the documentation.
Here is the code that traps exceptions:
def handle_error(self, request, client_address):
"""Handle an exception in the Server's callbacks gracefully.
Writes the error to sys.stderr and, if the error_prefix (see setSrvErrorPrefix()) is set,
sends the error-message as reply to the client
"""
(e_type, e) = sys.exc_info()[:2]
self.printErr("%s on request from %s: %s" % (e_type.__name__, getUrlStr(client_address), str(e)))
if self.print_tracebacks:
import traceback
traceback.print_exc() # XXX But this goes to stderr!
if len(self.error_prefix):
self.sendOSCerror("%s: %s" % (e_type.__name__, str(e)), client_address)
And here's is the simple way you turn trace on when you create the OSCServer instance:
import OSC
myoscserver = OSC.OSCServer( (host, port) )
myoscserver.print_tracebacks = True
This works for OSCClient as well:
myoscclient = OSC.OSCClient()
myoscclient.connect( (host, port) )
myoscclient.print_tracebacks = True
Hope that helps.