Re: [Twisted-Python] Using Twisted and GTK2
Thanks David. I'll take a look on your code Regards On Wed, 2010-02-03 at 11:03 -0800, David Ripton wrote: > On 2010.02.03 13:48:39 +0100, Ramiro Alba Queipo wrote: > > I recently new about Twisted and saw it as the best way to deal with a > > client/server network application (I use python long time ago). Really > > wonderful. I now intend to write a GTK client that can send commands and > > transfers files to the server and from it. > > I started to learn how to write applications not using 'Perspective > > Broker', but when I reached to the example pbgtk2.py to authenticate and > > send echo commands, I could no see a way the same with a PB. Is that > > true?. Is, anyway the best alternative (I mean PB) to write the > > application I intend to? > > PB is fine. AMP or Foolscap might be better for some tasks, but PB is > mature and works. > > PB features integration with Cred, which is Twisted's pluggable > authentication mechanism. > > http://twistedmatrix.com/documents/current/core/howto/cred.html > > Cred is very flexible. The integration between PB and Cred isn't quite > as flexible, but it works fine for straightforward cases. > > If you're looking for larger sample code, I have a game that uses PyGTK > and PB and Cred, here: > > http://github.com/dripton/Slugathon > > -- > David Riptondrip...@ripton.net > > ___ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > -- Ramiro Alba Centre Tecnològic de Tranferència de Calor http://www.cttc.upc.edu Escola Tècnica Superior d'Enginyeries Industrial i Aeronàutica de Terrassa Colom 11, E-08222, Terrassa, Barcelona, Spain Tel: (+34) 93 739 86 46 -- Aquest missatge ha estat analitzat per MailScanner a la cerca de virus i d'altres continguts perillosos, i es considera que està net. ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
[Twisted-Python] domish.Element.__getattr__() or xpath.XPathQuery
Hello everyone, I was wondering what you would recommend, accessing nodes via domish.Element.__getattr__() (e.g. el.node1.node1_1, where el is /msg) or via xpath.XPathQuery() (e.g. xpath.XPathQuery("/msg/node1/node1_1").queryForNodes(el)[0])? I was wondering which would be faster, the __getattr__() is O(n) (in my example there are 2 calls) but what about xpath.XPathQuery()? Thank you, Gabriel ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Using Twisted and GTK2
Hello everyone, Though, as far as I know, PB is not transfered in clear text. That means it's a little harder to debug the TCP streams, using a tool like Wireshark. Am I wrong? a 2010/2/4 Ramiro Alba Queipo : > Thanks David. I'll take a look on your code > > Regards > > On Wed, 2010-02-03 at 11:03 -0800, David Ripton wrote: >> On 2010.02.03 13:48:39 +0100, Ramiro Alba Queipo wrote: >> > I recently new about Twisted and saw it as the best way to deal with a >> > client/server network application (I use python long time ago). Really >> > wonderful. I now intend to write a GTK client that can send commands and >> > transfers files to the server and from it. >> > I started to learn how to write applications not using 'Perspective >> > Broker', but when I reached to the example pbgtk2.py to authenticate and >> > send echo commands, I could no see a way the same with a PB. Is that >> > true?. Is, anyway the best alternative (I mean PB) to write the >> > application I intend to? >> >> PB is fine. AMP or Foolscap might be better for some tasks, but PB is >> mature and works. >> >> PB features integration with Cred, which is Twisted's pluggable >> authentication mechanism. >> >> http://twistedmatrix.com/documents/current/core/howto/cred.html >> >> Cred is very flexible. The integration between PB and Cred isn't quite >> as flexible, but it works fine for straightforward cases. >> >> If you're looking for larger sample code, I have a game that uses PyGTK >> and PB and Cred, here: >> >> http://github.com/dripton/Slugathon >> >> -- >> David Ripton drip...@ripton.net >> >> ___ >> Twisted-Python mailing list >> Twisted-Python@twistedmatrix.com >> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python >> > -- > Ramiro Alba > > Centre Tecnològic de Tranferència de Calor > http://www.cttc.upc.edu > > > Escola Tècnica Superior d'Enginyeries > Industrial i Aeronàutica de Terrassa > Colom 11, E-08222, Terrassa, Barcelona, Spain > Tel: (+34) 93 739 86 46 > > > -- > Aquest missatge ha estat analitzat per MailScanner > a la cerca de virus i d'altres continguts perillosos, > i es considera que està net. > > > ___ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > -- Alexandre Quessy http://alexandre.quessy.net/ ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Conch channel blocked
On 2 Feb, 09:24 pm, jbar...@bu.edu wrote: >Hello, > >I'm trying to get a feel for twisted.conch, and not getting very far. >I know the documentation is lacking, but I'm not here to complain, I'm >here to figure this out. I only have a cursory knowledge of twisted so >far, so that may be some of my problem. I am however fairly familiar >with the internals of ssh, so I thought I could start there... > >I started with the sshsimpleclient example, took some pieces, and >began experimenting. >The example worked as expected. >Next, I wanted to pipe arbitrary data over the channel, as if I called >"ssh hostname 'cat > file'" >This however fills the remote buffer, and hangs > >Here's a small example >### >class ClientConnection(connection.SSHConnection): >def serviceStarted(self): >self.openChannel(CatChannel(conn = self)) > >class CatChannel(channel.SSHChannel): >name = 'session' >def channelOpen(self, data): >d = self.conn.sendRequest(self, 'exec', common.NS('cat > >/tmp/testfile'), > wantReply = 1) >d.addCallback(self._cbSendRequest) > >def _cbSendRequest(self, ignored): >f = open('testfile') >chunk = f.read(4096) >while chunk: >self.write(chunk) >chunk = f.read(4096) >f.close() >self.conn.sendEOF(self) >self.loseConnection() > > > >Also, setting the channel name to 'session', sending the 'exec' >request with the command as a netstring, etc. seem like something that >should be abstracted away. SSHSession with request_exec seemed like >the obvious choice, but I had no success in using that class for >anything. I can't run your example code, since it's not a complete example. That makes it harder to point out what's wrong with it. However, one thing does strike me as wrong: >while chunk: >self.write(chunk) >chunk = f.read(4096) This is a pattern you typically want to avoid, in Conch or anything else Twisted-based. I don't know if SSHChannel is a consumer, but if not it should be, and you should be writing the file using a producer. See: http://twistedmatrix.com/documents/current/core/howto/producers.html > >Does anyone know if any projects making good use of twisted.conch, >where I can see the source in action, and in depth? Mantissa uses Twisted Conch a bit: http://divmod.org/trac/browser/trunk/Mantissa/xmantissa/terminal.py But you won't find any code sending any exec requests there. Jean-Paul ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Conch channel blocked
On Thu, Feb 4, 2010 at 9:01 AM, wrote: > > I can't run your example code, since it's not a complete example. That > makes it harder to point out what's wrong with it. However, one thing > does strike me as wrong: >> while chunk: >> self.write(chunk) >> chunk = f.read(4096) > > This is a pattern you typically want to avoid, in Conch or anything else > Twisted-based. I don't know if SSHChannel is a consumer, but if not it > should be, and you should be writing the file using a producer. See: > It looked awkward, but the one example in the documentation was my only starting point. http://twistedmatrix.com/documents/current/conch/howto/conch_client.html This is only a slightly modified version of that example, which writes directly through the session channel, which makes sense in the ssh-protocol, but apparently not here. > http://twistedmatrix.com/documents/current/core/howto/producers.html >> Thanks. I'll see if I can relate that into conch. >>Does anyone know if any projects making good use of twisted.conch, >>where I can see the source in action, and in depth? > > Mantissa uses Twisted Conch a bit: > > http://divmod.org/trac/browser/trunk/Mantissa/xmantissa/terminal.py > > But you won't find any code sending any exec requests there. > That's OK. any little bit helps. I have a twisted service, and it needs to tunnel some information through an ssh channel. Although this would take me a couple minutes with another library, I feel I should be able to make use of what's already built in to twisted, and not add another dependency. -jim ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Using Twisted and GTK2
On 2010.02.04 08:23:20 -0500, Alexandre Quessy wrote: > Though, as far as I know, PB is not transfered in clear text. That > means it's a little harder to debug the TCP streams, using a tool like > Wireshark. Am I wrong? The PB wire format is documented here: http://twistedmatrix.com/documents/9.0.0/api/twisted.spread.jelly.html It's human-readable S-expressions. -- David Riptondrip...@ripton.net ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Using Twisted and GTK2
On 03:02 pm, drip...@ripton.net wrote: >On 2010.02.04 08:23:20 -0500, Alexandre Quessy wrote: >>Though, as far as I know, PB is not transfered in clear text. That >>means it's a little harder to debug the TCP streams, using a tool like >>Wireshark. Am I wrong? > >The PB wire format is documented here: >http://twistedmatrix.com/documents/9.0.0/api/twisted.spread.jelly.html > >It's human-readable S-expressions. Well, sort of... Jelly is the first stage of processing, but the output is lists of simple Python objects, which you can't put into a socket. So banana is the next stage of processing, which converts the output of jelly into bytes. It's fair to say that banana is not human readable. Just speaking from personal experience, I've never wanted to get wireshark (or similar tools) involved to debug a PB-using applications. As an application the developer, the problems encountered when using PB are things that are more easily debugged with pdb, unit tests, or inserting logging at a higher level (such as the PB message dispatch code). Banana works. Jelly works. It's very uncommon for them to get in your way. Jean-Paul ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Conch channel blocked
2010/2/4 james bardin : > On Thu, Feb 4, 2010 at 9:01 AM, wrote: >> >> I can't run your example code, since it's not a complete example. That >> makes it harder to point out what's wrong with it. However, one thing >> does strike me as wrong: >>> while chunk: >>> self.write(chunk) >>> chunk = f.read(4096) >> >> This is a pattern you typically want to avoid, in Conch or anything else >> Twisted-based. I don't know if SSHChannel is a consumer, but if not it >> should be, and you should be writing the file using a producer. See: >> > > It looked awkward, but the one example in the documentation was my > only starting point. > http://twistedmatrix.com/documents/current/conch/howto/conch_client.html > > This is only a slightly modified version of that example, which writes > directly through the session channel, which makes sense in the > ssh-protocol, but apparently not here. > > >> http://twistedmatrix.com/documents/current/core/howto/producers.html >>> > > Thanks. I'll see if I can relate that into conch. > >>>Does anyone know if any projects making good use of twisted.conch, >>>where I can see the source in action, and in depth? >> >> Mantissa uses Twisted Conch a bit: >> >> http://divmod.org/trac/browser/trunk/Mantissa/xmantissa/terminal.py >> >> But you won't find any code sending any exec requests there. >> > > That's OK. any little bit helps. > I have a twisted service, and it needs to tunnel some information > through an ssh channel. Although this would take me a couple minutes > with another library, I feel I should be able to make use of what's > already built in to twisted, and not add another dependency. Maybe you can use connection forwarding in conch? Have a look at http://twistedmatrix.com/trac/browser/trunk/twisted/conch/scripts/conch.py to see how the forwarding API works. Kuba > > -jim > ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] PyCon 2010 Twisted Sprint
On Jan 31, 2010, at 7:05 PM, Glyph Lefkowitz wrote: > On Jan 31, 2010, at 5:26 PM, exar...@twistedmatrix.com wrote: > >> If there are enough interested people, there will be a Twisted sprint at >> PyCon this year. If you'll be at PyCon and are interested in sprinting >> on some Twisted topic, give a shout. Also, let us know what specific >> topics you're interested in so we can let other people know what to >> expect in the general announcement. > > I will be there for one day of the sprints. I'm interested in web2 By "web2" do you mean porting more of web2 back to web? S ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
[Twisted-Python] web2 -> web ToDo List
While I see tickets in the tracker for web2 and others for web, I couldn't find a 'cherry pick' list of things to be moved from web2 back into web. Is there one? Thanks, S ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python