hi there, folks:
I'd really like to release 0.7.0 but I would like it to be at least a
little bit tested before I do so. Could those of you with CVS trees check
everything out and see if it performs as advertised? Deeper bugs than
that will have to wait for the next release, but I'd at least like to know
if it works for someone other than me.
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
On 18 May 2004, the following message was posted to this mailinglist:
Jp Calderone exarkun at divmod.com wrote:
>Daniel Newton wrote:
> I have a simple XML-PRC server similar to the example below:
> from twisted.web import xmlrpc, server
> class Example(xmlrpc.XMLRPC):
> """An example object to be published."""
> def xmlrpc_add(self, a, b):
> """Return sum of arguments."""
> return a + b
> if __name__ == '__main__':
> from twisted.internet import reactor
> r = Example()
> reactor.listenTCP(7080, server.Site(r))
> I want to be able to get the address of the client that calls the
> method can anyone help me with this?
This solution didn't work because 'transport' isn't a property of the
I'm currently in the process of changing from a customized
SimpleXMLRPCServer to a twisted XMLRPC server solution and I need to
insert the client IP into the attributes passed to the called xmlrpc
method. Anyone who knows the answer and is willing to share the info?
I'm using Twisted 1.3.0 on python2.4 on an Ubuntu-Hoary x86 Linux box.
I'm using twisted and spawnProcess() with a Queue structure to chain
processes that need to be called (specifically, imagemagick commands).
I use the "processEnded" event/method of t.i.p.ProcessProtocol to go
from one task to the next. Twisted shares a python process with a
multi-threaded web-app-kit (Webware) so it has to be run in a thread.
This worked well on other older versions of twisted and older versions
of python; also on linux. I've tracked down the problem to be twisted
itself (or my incorrect use of it) rather than my code. This example
from twisted.internet import reactor
from twisted.internet.protocol import ProcessProtocol
class MyProt( ProcessProtocol ):
def processEnded(self, reason):
print "ended.", reason
executable = '/bin/touch'
args = ( '/tmp/foo.txt', )
args = (executable,) + tuple(args)
reactor.spawnProcess( MyProt(), executable, args )
reactor.callLater( 5, reactor.stop )
As is, this code never runs the "processEnded()" method of MyProt().
If I change the reactor.run() parameter to leave the signal handlers
on, it works.
Note that I need to leave the signal handlers turned off because I
can't run the reactor in the main thread; Webware needs that.
I also know that the subprocess is giving up its file descriptors; I
can see that if I put more print statements into MyProt(). And I know
that the subprocess is working; /tmp/foo.txt is there.
It seems that somehow the reactor is using signals to notice when a
process has ended; this makes a certain ammount of sense intuitively,
though I don't understand the nitty-gritty of processes and signals at
all. And more importantly, this has worked before on other
combinations of twisted/python.
Is this a bug? If so, has it been fixed? If not, what should I do to
detect when a spawned process is finished?
Thanks very much. Twisted rocks.
wxreactor in Twisted 2.1 uses threadedselectreactor. This means that wx
apps ought to use wxreactor, not TSR directly; there are some issues
with vanilla TSR wx integration that are also present in wxreactor, but
will be fixed in future versions of wxreactor.
What's broken (there may be more):
1. reactor shutdown events aren't handled correctly (e.g. Deferred
returned from during-shutdown event).
2. Signal handling for e.g. Ctrl-C is caught by wx, not twisted.
In order to get these fixed I need your help. I have a version of
wxreactor that *probably* fixes these in Subversion trunk. You can try
it out by running doc/core/examples/wxdemo.py. Hitting Ctrl-C, choosing
Exit from the menu or closing the menu all should have the same effect -
the application logs "shutting down in 0.3 seconds...", "2", "1", "0"
then exits. In addition, "Hello world" should continue to be printed
while the dialog box is open or you are holding down a menu.
Please try this out, and report success or failure at
<http://twistedmatrix.com/bugs/issue1235>. I'm especially interested to
hear if it works on Windows or Mac OS X. Please include your OS and
version of wxPython/wxWidgets when submitting reports.
Should we drop Python 2.2 support in Subversion head for Twisted 2.2?
- Debian stable now comes with Python 2.3
- Twisted 2.1 has been released with Python 2.2 support
Dropping Python 2.2 support has some good consequences:
- We get to delete code
- An entire class of bugs gets eliminated
- Disc space can be freed on the muon buildslave
Some bad consequences:
- People wanting to run Twisted 2.2 (or svn) on ancient versions of
Python won't be able to.
I am not only new to twisted, but to python as well.
I need what twisted does, so went out and got the "twisted" book
by abe fettig. I am coding each example in the book as i get there.
the connectiontest.py example on page 16 gives me a call back on success,
but not on error.
from twisted.internet import reactor,defer, protocol
protocol = CallbackAndDisconnectProtocol
self.deferred = defer.Deferred()
def clientConnnectionFailed(self, connector, reason):
def testConnect(host, port):
testFactory = ConnectionTestFactory()
reactor.connectTCP(host, port, testFactory)
def handleSuccess( result,port):
print "Connected to port %i" % port
def handleFailure(failure, port):
print "Error connecting to port %i: %s" % (port,failure.getErrorMessage())
if __name__ == "__main__":
if not len( sys.argv) == 3:
print "Usage: connectiontest.py host port"
host = sys.argv
port = int(sys.argv)
connecting = testConnect(host, port)
# connecting.addCallback( handleSuccess, port)
# connecting.addErrback( handleFailure,port)
The environment is:
Windows XP sp2
python 2.4.1 from activestate
When chasing this down, go into the main loop and there are
comments about "signals" not working in windows, etc. etc.
CallLater works fine, successful callback works fine, the errback
thanks in advance
On Sun, 27 Nov 2005 23:35:45 -0700, Jonathan Lange <jml(a)wolfwood.twistedmatrix.com> wrote:
>Date: Sun Nov 27 23:35:45 2005
>New Revision: 15230
>Merge of jml/trial-deferred-logic -r15183:15229. Resolves #1341.
The Gtk reactor can no longer complete the test suite: http://twistedmatrix.com/buildbot/reactors/builds/884/step-gtk/0
On my machine, the suite hangs in twisted.web.test.test_webclient.CookieTestCase.testNoCookies, but it seems to die in twisted.test.test_tcp.HalfClose2TestCase.testNoNotification on buildbot every time. This may just be a race (or several races) going different ways on a somewhat reliable fashion on the different hardware.
It seems like the remaining reactor.iterate() calls are the likely cause of this?
Using a suggestion from David Mertz's old article I am implementing scp using Conch. I can scp from the server to the client, it does give an exception listed below. Question #1 is why is the exception happening? Question #2 is how to scp from the client to the server? Can I use sendRequest() to open a file and then Channel.write('some data') to send the client file contents?
Traceback (most recent call last):
File "client_mertz.py", line 80, in ?
File "/usr/lib/python2.3/site-packages/twisted/internet/posixbase.py", line 206, in run
File "/usr/lib/python2.3/site-packages/twisted/internet/posixbase.py", line 214, in mainLoop
--- <exception caught here> ---
File "/usr/lib/python2.3/site-packages/twisted/internet/base.py", line 541, in runUntilCurrent
File "/usr/lib/python2.3/site-packages/twisted/internet/base.py", line 397, in _continueSystemEvent
for callList in sysEvtTriggers, sysEvtTriggers:
exceptions.TypeError: unsubscriptable object