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.
On 27 Nov, 07:04 pm, foom(a)fuhm.net wrote:
>The other option is to upgrade wolfwood to debian stable ("sarge") and then
>just install svn 1.4 from testing. That might be a good idea anyhow, since
>oldstable is, well, old. And unsupported.
It would be good to know, for the purposes of such discussions, who the official admin of these hosts is. If I knew, I'd ask that person to please upgrade everything to Dapper, thanks to its long updates support cycle and my relatively stable experience with it. Without knowing who it was and how long it's going to take though, it's hard to make suggestions.
On 27 Nov, 06:19 pm, ncesar(a)lunix.com.ar wrote:
>El S�bado, 25 de Noviembre de 2006 02:39, glyph(a)divmod.com escribi�:
>> >I was wondering if twistd/the application class could have a "exit on
>> >Exception" for this type of operations.
>> In general this is a bad idea. There are basically 3 kinds of code you can
>> write with Twisted:
>> 1. Infrastructure code, which implements a protocol and provides APIs for
>> parsing and dealing with events. This kind of code should never contain a
>> reactor.stop at all.
>Actually is type 1, but there are horrible (network) conditions were de
>application should stop.
No, there aren't. What happens when I run your application in-process with my webserver? Should the webserver stop simply because your protocol is not working?
>Even it's not type 3, I get your point. And thats why I didn't want to write
>ANY reactor.stop() call, instead just raise exceptions- And have a unnified
>reactor.stop() inside somewhere in twistd. But it seems I need to think
>another solution. Right now as a workaround, reactor.stop() will be inside my
>exception's __init__ function ;-)
Just don't call reactor.stop at all unless you are writing top-level infrastructure code. Your application should have some other, more structured way of reporting fatal shut-down errors to its run container (e.g. runContainer.applicationEncounteredFatal(xxx)), not simply raising exceptions and hoping someone is listening. Unless you give more specifics that indicate that your special case is special-er than any other I've seen before, I'll stand by this. :)
>> Don't try to always stop the *process* when your program is
>> complete: stop the *program* by keeping a Deferred around which represents
>> its complete run. That way the *driver* for the program is responsible for
>> stopping it, and when you want to aggregate multiple runs of it, you can
>> easily use a tool like DeferredList, or do something different in the
>> callbacks at the end.
>I couldn't understand much of this last parragraph (my English reading could
>be part of the problem). I understand algorithms mucho more when are written
>in python instead of English, Do you have a link to some code explaning
It's hard for me to think of a program which does this in a simple way. If I can think of one I will post an example.
I need to process the thinkCSpy ebook lore source to latex urgently,
however there is a bug in the curent stable version which prevents
compiling spanned chapters.
which is fixed very recently but doesn't yet seem to be merged with
the trunk (I have downloaded the svn trunk and tried its lore, but
still has the same bug)
Can anyone give me (or point to the place where I can download) the
updated file so that I can do my job immediately?
On 06:47 pm, markus(a)bluegap.ch wrote:
>A long time ago, I've been asking about a blocking callFromThread function
>and have been pointed to ticket 1042 at . What's the state on that? Does
>that have a change of being integrated into twisted?
At the very least, the function there needs tests, documentation, and a use-case for some code that is going to want to call it from within Twisted - and I don't think there is any currently.
There are probably a few things that are painful to do without such a function, but in general this sort of thing is just a recipie for deadlocks and running out of threads in your pool, so I am not inclined to push it forward.