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?
Does anyone have some example code for building a reconnecting PB client?
This is what I have now:
from twisted.spread import pb
from twisted.internet import reactor
from twisted.python import util
events = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, events)
queue = events.getRootObject()
I'm new to Twisted, I only had a limited experience using python and its
asyncore/asynchat. I went through Twisted Howto doc.
I just realized that reactor.listenTcp() will only take "listening port" as its
parameter. If I want to run a Twisted Program on a machine with multiple
network cards(NICs) associated with different IP addresses and I only want
my program listening on a specific IP address or NIC, is there a way I
can pass listening IP address to reactor.listenTcp() so it'll only accept
the connections from a certain NIC/IP Address?
Thanks a lot for your help!
I've been googling if there is any 'ICMP ping' support in Twisted. I've
encounter ancient replies:
I wonder if today is any ICMP support. I've tried to search the source
tree, and doesn't seem.
My actual needs is creating a DeferredList with "ping-testers" for different
IPs, just to check if there up or not.
I know I can end up using twisted.internet.utils.getProcessOutput and calling
ping, as I would normally do from command line. For other newbies as me in
the same situation please read:
http://twistedmatrix.com/users/moshez/talk.html and search
for 'getProcessOutput' ;-)
 my search was:
$ grep -C3 -ir icmp *
internet/protocol.py: """Abstract protocol for datagram-oriented
transports, e.g. IP, ICMP, ARP, UDP."""
internet/protocol.py- transport = None
internet/protocol.py- numPorts = 0
internet/protocol.py- def connectionRefused(self):
internet/protocol.py- """Called due to error from write in connected
internet/protocol.py: Note this is a result of ICMP message generated
Nicolás D. César <ncesar(a)lunix.com.ar>
Lunix S.R.L. -[ http://www.lunix.com.ar ]-
GnuPG Public Key: gpg --keyserver wwwkeys.pgp.net --recv-key 0x3606F3E6
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.
It's been a while since this was discussed on the list, but I also
have a use-case where extra args to twistd would be far more useful
than any other option. I'm doing a little p2p thing (which I'm sure
is not all that uncommon), and of course I want to test aggregate
behavior of many instances, so I instantiate 100 or so on my own box.
Not being able to pass in extra args to twistd makes this obviously
painful, as it adds the extra step of creating a bunch of
configuration or a hoard of different tac files, whereas I can spit
out a simple script that spawns instances with much more ease and
Just something to chew on as you all think about adding such a feature
> On Fri, 9 Jun 2006 23:03:06 +0200, Terry Jones <terry at jon.es> wrote:
>>Something like allowing
>> $ twistd -twistedopts file -- extra args here...
>>would be nice. Or is there a better way to do this?
>.tac files _are_ configuration, so they don't _take_ configuration. You
>should have so little code in your .tac file that it is neither burdensome
>nor distasteful to make a copy and change bits of it to meet particular
>On the other hand, .tac files are far from the final word on configuration.
>They're just the last word Twisted has put in so far ;) No doubt we'll see
>something better added at some future date.