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
I would like to announce txZMQ, ZeroMQ bindings for Twisted. txZMQ is based
on pyzmq and requires recent ØMQ version (>=2.1).
txZMQ uses ØMQ APIs to get file descriptor that is used to signal pending
actions from ØMQ library IO thread running in separate thread. txZMQ should
be usable with any Twisted reactor.
* The socket library that acts as a concurrency framework.
* Carries messages across inproc, IPC, TCP, and multicast.
* Connect N-to-N via fanout, pubsub, pipeline, request-reply.
* Fast enough for clustered products and supercomputing.
* Asynch I/O for scalable multicore message-passing apps.
Bridging ØMQ and Twisted makes a nice match: fast simple messaging between
Twisted instances solving complex problems :)
* PyPi: http://pypi.python.org/pypi/txZMQ/
* Source code: https://github.com/smira/pyzmq
* pyzmq: http://pypi.python.org/pypi/pyzmq
* ØMQ: http://www.zeromq.org/
Qik Web Team Lead
I have an xml file in my application,
I have created an element using
Example goes like this.........
and i appeneded it by using append() method.
But how i can reflect this change to my xml file?
and one more thing is i want to create element with some other parameters....
<abc m=" " n=" ">
and i have m and n values as strings with me.
can anybody help me to create this element and write it to the existing xml file
as a child of an existing element?
Thanks in advance..
Forgot the famous last words? Access your message archive online at http://in.messenger.yahoo.com/webmessengerpromo.php
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 encountered a problem while dealing with file transfers using PB and t.s.u.FilePager.
The sscce illustrates the problem:
--------- server.py --------------------------------------------------
from twisted.spread import pb
from twisted.internet import reactor
ROOT = '/tmp/'
def __init__(self, fd):
self.fd = fd
def remote_gotPage(self, page):
def remote_createImage(self, imageId):
return ImageCollector(open(ROOT + imageId, 'w'))
--------- client.py --------------------------------------------------
from twisted.spread import pb
from twisted.internet import reactor, defer
from twisted.spread import util
FILE = 'myfile.something'
factory = pb.PBClientFactory()
reactor.connectTCP("localhost", 8789, factory)
d = factory.getRootObject()
return controller.callRemote('createImage', 'image-id')
print ctl.callRemote('dummy') ############# LINE 19 #############
d = defer.Deferred()
util.FilePager(ctl, open(FILE), callback=lambda: d.callback(None))
print "Transfer completed"
I'm trying to *upload* a file from the client to the server by calling a method on the
server which returns a collector to be used with a FilePager instance.
When run with the line client.py:19 commented out, the script blocks before sending
out any file chunks, if the line is uncommented (effectively calling the 'dummy' method
remotely), everything works as expected.
Digging around in the sources, I found out that t.p.u.Pager registers itself to the
collector's pb broker as a pageProducer. When resumeProducing is called on the broker,
it asks the FilePager instance for the next page, which leads to the invocation of
the following method on FilePager::
Get the first chunk read and send it to collector.
if not self.chunks:
val = self.chunks.pop(0)
As the t.b.FileSender producer does not yet had a chance to write something to the
FilePager, the method returns straight away without sending anything.
As anything was sent, the Broker.resumeProducing method is never called again, and
thus the FilePager.sendNextPage neither.
The problem is caused by the calling chain of the FilePager constructor:
-> <no data, don't send anything>
-> FileSender().beginFileTransfer(fd, FilePager)
-> <store data, wait for sendNextPage to be called>
Simply inverting these two method calls (Pager.__init__ and FilePager.startProducing)
solves the problem.
The same problem does not appear when calling the 'dummy' method (client.py:19)
because the data for the method call is waiting to be sent out by the reactor and
the transport does not call 'resumeProducing' on the broker until the next iteration.
This allows the call to FilePager.startProducing to complete before sendNextPage is
ever called on it.
Does this sound correct? It seems only strange to me that nobody else had this problem
previously. If no errors on my side are found, I'll submit this as a ticket.
I have a question about the "best practices" on making callbacks and making sure you don't hog the reactor.
So you pass a deferred to a client, who attaches a chain of callbacks that might probably do some CPU intensive stuff. How should one guard for that? The obvious solution to me for the server part would be to do
reactor.callLater(0, d.callback, arg)
What about the client part? What would be the best way to have a chain of callbacks executed in such a way that the reactor isn't blocking during that time?
In relation to my recent getChild problem (specifically, I want to return
deferred resources from it), it has become evident that IResource just won't
cut it for a number of reasons and we should probably replace the API with
The issues we should take care of in this new API:
1. http://tm.tl/3711 (returning deferreds from render methods)
2. http://tm.tl/3621 (returning deferreds from getChild and friends)
3. http://tm.tl/288 (accessing uploaded data while in progress)
If there are any missing tickets I'm forgetting about that are only fixable
by breaking the interface, now would be a good time to speak up.
I have created a new ticket (http://tm.tl/5152) for the new interface using
an integration branch that addresses the issues in the individual tickets on
a new interface as Glyph proposed. I've also commented on #3711 to say that
it just won't work that way and that we need a new interface, referring them
to the new ticket number.
What should the migration plan look like? At least from the code point of
view, exarkun has already partially answered this question:
I'm trying out Twisted/Conch as a replacement for a script based upon
Paramiko for transferring some files around. However, I'm not able to
get my Twisted/Conch script to authenticate to the remote server using
public keys. Password authentication works in my Twisted/Conch script
and public key authentication works when I connect to a local server
that uses OpenSSH. The remote server identifies itself as
"SSH-2.0-http://3sp.com_Maverick_SSHD". Can anyone give me any tips
on what might be going wrong? Is there a way to increase the
verbosity to see what might be going on?