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'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.
The documentation above says that credentials should be able to do
authentication with multiple passes. However, I have not been able to find
any examples of it.
As an alternative, I was going to implement a user object with state that
determined what it was able to do. I could force the client to conduct
multiple challenge responses to achieve the logged in state.
I figured it would be better to ask the mail list for the proper way to do
when I run a service through twistd
# twistd --pidfile service.pid -y service.py
in logfile, I see:
Warning: No permission to delete pid file
Because I run this service as ordinary user, not root:
application = service.Application("serviceMine", uid, gid)
, but the owner of pidfile is still root, not ordinary user!
so when I shutdown this service, this pid file cannot be deleted!
William Hanwoody hanwoody(a)gmail.com
A senior Linux engineer, like system integrate
My blog - hanwoody.livejournal.com
I am working on an example:
from twisted.internet.app import Application
from twisted.internet.protocol import Protocol, Factory
"""Serve a sequence of Fibonacci numbers to all requesters"""
def dataReceived(self, data):
= self.factory.a + self.factory.b
self.transport.write('%d' % self.factory.new)
self.factory.a = self.factory.b
self.factory.b = self.factory.new
import fib_server # Use script as namespace
f = Factory()
f.protocol = fib_server.Fibonacci
f.a, f.b = 1, 1
application = Application("Fibonacci")
if'__main__' == __name__:
I have questions as the following:
1. Is application.save( ) that make Fibonacci.tap file?
2. testing on "twistd -f Fibonacci.tap" got message "Failed to load
application: No module named fib_server".Can we use script as namesp?