[PyKDE] Bizarre backtrace?
Hans-Peter Jansen
hpj at urpla.net
Tue Jul 2 10:25:02 BST 2002
On Mon, 1 Jul 2002 17:54:31 -0400 (EDT)
"Bill Soudan" <bill at soudan.net> wrote:
>
> On Mon, 1 Jul 2002, Phil Thompson wrote:
>
> > sipThis is created by the ctor of a PyQt class. Normally this error
> > occurs when you have sub-classed a PyQt class but forgot to call the
> > PyQt class __init__() from your sub-class's __init__().
>
> Interesting. I don't think that's the problem here though, because the
> error occurs inside an object that has nothing to do with PyQt at all. I
> verified all of my GUI elements are in fact invoking the superclass's
> __init__ anyway.
>
> Here's some relevant code snippets:
>
> class MainWindow(MainWindowBase):
> def __init__(self, parent = None, name = None, f = 0):
> MainWindowBase.__init__(self, parent, name, f)
>
> self.sockets = {}
>
> ...
>
> self.addMonitor('host', 21992)
>
> ...
>
> def addMonitor(self, host, port):
> i = MonitorItem(host, port, self.listView)
> fd = i.subscriber.fileno()
> sn = QSocketNotifier(fd, QSocketNotifier.Read, self)
> self.connect(sn, SIGNAL('activated(int)'), self.handleSocketNotification)
> self.sockets[fd] = i
>
> ...
>
> def handleSocketNotification(self, fd):
> print 'socket_notifier fired, handling request'
> s = self.sockets[fd].subscriber
> s.handle_request()
>
> The 'MonitorItem' is a subclass of QListViewItem, which contains an
> instance of a Subscriber class that is derived from the XMLRPC code. It
> knows nothing about PyQt. The exception is occuring when QSocketNotifier
> emits an activated signal. That's connected to handleSocketNotification,
> which in turn invokes the handle_request method on an instance of the
> Subscriber class. Past this point, the code has nothing to do with PyQt,
> but I'm receiving that strange exception from deep inside the standard
> library's SocketServer code.
>
> Any other thoughts?
>
> Thanks,
> Bill
>
Couldn't this scenario create race conditions? Did you tried using mutexes
to prevent them? May be try to reduce the code to the problem domain and post
it here?
Hans-Peter
More information about the PyQt
mailing list