[Twisted-Python] wx and twisted
Hi all, just installed the last wx and twisted and tring my already working app and: Traceback (most recent call last): File "threading.py", line 442, in __bootstrap self.run() File "threading.py", line 422, in run self.__target(*self.__args, **self.__kwargs) File "/usr/lib/python2.4/site-packages/twisted/internet/_threadedselect.py", line 149, in _workerInThread fn(*args) --- <exception caught here> --- File "/usr/lib/python2.4/site-packages/twisted/internet/_threadedselect.py", line 169, in _doSelectInThread [], timeout) exceptions.ValueError: file descriptor cannot be a negative integer (-1) and on shutdown: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14364, in <lambda> lambda event: event.callable(*event.args, **event.kw) ) File "/usr/lib/python2.4/site-packages/twisted/internet/_threadedselect.py", line 243, in _interleave msg, args = self.toMainThread.get_nowait() File "/usr/lib/python2.4/Queue.py", line 141, in get_nowait return self.get(False) File "/usr/lib/python2.4/Queue.py", line 116, in get raise Empty Queue.Empty How debug it? Debian etch, python 2.4.4, wx 2.8.7.1, twisted 2.5.0 Thanks, Michele
On Mon, 03 Dec 2007 14:33:44 +0100, Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it> wrote:
Hi all, just installed the last wx and twisted and tring my already working app and:
Traceback (most recent call last): File "threading.py", line 442, in __bootstrap self.run() File "threading.py", line 422, in run self.__target(*self.__args, **self.__kwargs) File "/usr/lib/python2.4/site- packages/twisted/internet/_threadedselect.py", line 149, in _workerInThread fn(*args) --- <exception caught here> --- File "/usr/lib/python2.4/site- packages/twisted/internet/_threadedselect.py", line 169, in _doSelectInThread [], timeout) exceptions.ValueError: file descriptor cannot be a negative integer (-1)
and on shutdown:
Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14364, in <lambda> lambda event: event.callable(*event.args, **event.kw) ) File "/usr/lib/python2.4/site- packages/twisted/internet/_threadedselect.py", line 243, in _interleave msg, args = self.toMainThread.get_nowait() File "/usr/lib/python2.4/Queue.py", line 141, in get_nowait return self.get(False) File "/usr/lib/python2.4/Queue.py", line 116, in get raise Empty Queue.Empty
How debug it?
Start looking at what has changed in wx since the previous working version, or start looking at which calls are resulting in invalid file descriptors. Or you could try to get the Twisted unit tests to run with wxreactor, and then work on making them pass. Jean-Paul
On Dec 3, 2007, at 8:47 AM, Jean-Paul Calderone wrote:
On Mon, 03 Dec 2007 14:33:44 +0100, Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it
wrote:
[snip traceback]
exceptions.ValueError: file descriptor cannot be a negative integer (-1)
and on shutdown:
[snip traceback]
How debug it?
Start looking at what has changed in wx since the previous working version, or start looking at which calls are resulting in invalid file descriptors.
Or you could try to get the Twisted unit tests to run with wxreactor, and then work on making them pass.
I'm pretty sure that this is truly impossible with the current wxreactor, and possibly any reactor that is based on TSR. I found this out while trying to implement a corefoundation reactor using wxreactor as a reference. My actual experience with wxWidgets is limited, but as far as I can tell, the same issue exists. Tests won't run because wxreactor.stop() will never stop the toolkit's main loop by itself, and anything that makes the loop end will also terminate the process. I posted some comments on: http://twistedmatrix.com/trac/ticket/1833 "there are architectural choices in TSR that prevent most of its use- cases from being fully tested. The biggest problem is that TSR allows the native toolkit's event loop to dictate when the reactor will stop. This has the most obvious implications when dealing with Trial. Trial assumes that reactor.run() will return after another thread calls reactor.crash(). This can't be done in Cocoa (so far as I can tell), because anything I've found that will make PyObjCTools.AppHelper.runEventLoop() stop will terminate the entire process. This seems to also be the issue for t.i.wxreactor." -phil
On Mon, 3 Dec 2007 11:41:33 -0500, Phil Christensen <phil@bubblehouse.org> wrote:
On Dec 3, 2007, at 8:47 AM, Jean-Paul Calderone wrote:
On Mon, 03 Dec 2007 14:33:44 +0100, Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it > wrote:
[snip traceback]
exceptions.ValueError: file descriptor cannot be a negative integer (-1)
and on shutdown: [snip traceback]
How debug it?
Start looking at what has changed in wx since the previous working version, or start looking at which calls are resulting in invalid file descriptors.
Or you could try to get the Twisted unit tests to run with wxreactor, and then work on making them pass.
I'm pretty sure that this is truly impossible with the current wxreactor, and possibly any reactor that is based on TSR. I found this out while trying to implement a corefoundation reactor using wxreactor as a reference.
[snip]
I didn't say it would be easy. Few things are impossible, though. Jean-Paul
On Dec 3, 2007 10:41 AM, Phil Christensen <phil@bubblehouse.org> wrote:
On Dec 3, 2007, at 8:47 AM, Jean-Paul Calderone wrote:
On Mon, 03 Dec 2007 14:33:44 +0100, Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it
wrote:
[snip traceback]
exceptions.ValueError: file descriptor cannot be a negative integer (-1)
and on shutdown:
[snip traceback]
How debug it?
Start looking at what has changed in wx since the previous working version, or start looking at which calls are resulting in invalid file descriptors.
Or you could try to get the Twisted unit tests to run with wxreactor, and then work on making them pass.
I'm pretty sure that this is truly impossible with the current wxreactor, and possibly any reactor that is based on TSR. I found this out while trying to implement a corefoundation reactor using wxreactor as a reference.
My actual experience with wxWidgets is limited, but as far as I can tell, the same issue exists. Tests won't run because wxreactor.stop() will never stop the toolkit's main loop by itself, and anything that makes the loop end will also terminate the process.
This isn't accurate, with regards to wxreactor - wxreactor shuts down the wx main loop using a system event, and the wx main loop is restartable so there's no intrinsic problem with doing this. The way wxreactor tries to interact with the wxApp is pretty kludgy and might result in problems, though. I'm not sure why trial has so many problems with wxreactor - stuff which works fine outside of trials environment fails hard within it. It seems to have something to do with TSR, though - its _interleave loop is raising StopIteration.
Jean-Paul Calderone wrote:
Start looking at what has changed in wx since the previous working version,
on wxpython? It's very very hard because, like I can see, it can be also a wxwidget problem... (since wx.App it's a C class)
or start looking at which calls are resulting in invalid file descriptors.
Simplest, I think. How do it? Where to start? Or in the worst case, can I "skip" them? Because apart the shown errors, the application (an ftp client) seem to work well! P.s. From my tests, these errors appear only on my linux platform, not on win! Surely because wx it's more "windows" like that "linux" like, but however it's very strange!
Or you could try to get the Twisted unit tests to run with wxreactor, and then work on making them pass.
Sorry, but I think that I'm not so able to do it... Thanks, Michele
participants (4)
-
Chris Mellon
-
Jean-Paul Calderone
-
Michele Petrazzo - Unipex srl
-
Phil Christensen