I am trying to use twisted.conch.ssh to write an application that first sets
up an ssh connection that forwards port 5432 from an external server to my
local machine and then locally connect to a database running on the server
using that port. I am able to write two separate applications that
accomplish what I want, but I am unable to integrate them into one. Using
the two application approach, I can first start the application that sets up
my port forwarding and then start the application that connects to my
database. I can then make queries using the second application and
everything seems to work just fine. When integrating them into one
application I am still able to connect to the database, but I cannot run any
queries over it. The queries hang indefinitely, and neither my callback nor
my errback functions that should run after the query has completed ever get
called. My setup for implementing this is as follows....
I have introduced a deferred when setting up my port forwarding that gets
its callback only once the startFactory() event gets called for my class
derived from forwarding.SSHListenForwardingFactory. The forwarding is setup
using the following code snippet.....
reactor.listenTCP(PORT, DatabaseForwardingFactory(self.conn, (LOCALHOST,
Does anyone have any idea why this might not be working? I tried deferring
my query to a thread to see if this would help matters, but to no avail.
Any help at all would be appreciated.
i'm looking for a way to stream video in python (streaming server for
video captured from camera), any tips/examples/docs for doing this
i'm asking because i have no experience with twisted and any help is
also, is it possible to use py2exe to create executable files. if
using py2exe is not a problem, what is recommended way of using py2exe
Well thanks Bob!
btw. wx.FutureCall (ms, func, arg) instead or reactor.callLater works they way i was expecting it to work.
>On Jul 12, 2006, at 1:43 AM, mail(a)ortling.com wrote:
>> I have a problem with a modal dialog blocking wxreactor. If
>> ShowDialog () is called from within a deferred callback which has
>> been started by reactor.callLater everything twisted comes to a
>> halt and continues only after the modal dialog has been closed. The
>> sample script below should demonstrate the problem. I'm using
>> twisted 2.2 for python2.4.
>Twisted-Python mailing list
I have a problem with a modal dialog blocking wxreactor. If ShowDialog () is called from within a deferred callback which has been started by reactor.callLater everything twisted comes to a halt and continues only after the modal dialog has been closed. The sample script below should demonstrate the problem. I'm using twisted 2.2 for python2.4.
Help! and thanks in advance
import sys, os
from twisted.internet import wxreactor
from twisted.internet import reactor, defer
class Frame (wx.Frame):
def __init__ (self, parent, id, title):
wx.Frame.__init__ (self, parent, id, title)
btn_dlg = wx.Button (self, -1, "Press", size=(240, 180))
btn_dlg.Bind (wx.EVT_BUTTON, self.click)
def click (self, event):
d = defer.Deferred ()
def prepare (self, d):
uncomment reactor.callLater or d.callback to test
reactor.callLater (1.0, d.callback, 1) # this will fail
#d.callback (1) # this will work
def show (self, val):
for i in range (20):
reactor.callLater (i*0.2, self.dosth, i) # these will be printed _after_ dialog has been closed
dlg = wx.MessageDialog (self, "I am a dialog", "Dialog", style=wx.OK|wx.CANCEL)
ruckgabe = dlg.ShowModal ()
if ruckgabe == wx.ID_OK:
print "not okay"
def dosth (self, idx):
print "doing something nr", idx
class App (wx.App):
def OnInit (self):
self.frame = Frame (None, -1, "Test")
if __name__ == "__main__":
app = App ()
Sometime I receive a strange error:
File "hylaproto_t.pyo", line 209, in _RetrStatus
File "twisted\protocols\ftp.pyo", line 2190, in list
File "twisted\protocols\ftp.pyo", line 2006, in receiveFromConnection
File "twisted\protocols\ftp.pyo", line 2081, in _openDataConnection
File "twisted\protocols\ftp.pyo", line 1838, in queueCommand
File "twisted\protocols\ftp.pyo", line 1819, in sendNextCommand
File "twisted\protocols\ftp.pyo", line 2128, in generatePortCommand
File "twisted\internet\tcp.pyo", line 591, in getHost
AttributeError: 'Client' object has no attribute 'socket'
At line 209 in hylaproto_t, I have:
self._myClient are an FTPClient instance.
What can be the problem?
I have a couple of services. The second is dependent on the first being
fully initialised before the second gets set up.
I thought that the order of Service startup was typically handled by
organising services in a hierarchy, and that the startup of the
hierarchy understood deferreds. I was wrong - service.Application is a
MultiService and only understands deferreds in stopService.
There's a DependentMultiService class in twisted.internet.app but that
entire module has been deprecated.
Is there a reason why the MultiService does not support deferreds in
Is there a reason that DependentMultiService was not moved across to the
In other words, what is the recommended way of starting services in the
correct order, including waiting for them to get initialised fully,
/ \__ Matt Goodall, Pollenation Internet Ltd
\__/ \ w: http://www.pollenation.net
__/ \__/ e: matt(a)pollenation.net
/ \__/ \ t: +44 (0)113 2252500
/ \ Any views expressed are my own and do not necessarily
\__/ reflect the views of my employer.
On 7/8/06, Alec Matusis <matusis(a)matusis.com> wrote:
> >You can have as many processes listening on a single MULTICAST UDP port
> you like.
> Well, I am trying to run this example multicast UDP server:
> from twisted.internet.protocol import DatagramProtocol
> from twisted.internet import reactor
> from twisted.application.internet import MulticastServer
> class MulticastServerUDP(DatagramProtocol):
> def startProtocol(self):
> print 'Started Listening'
> # Join a specific multicast group
> def datagramReceived(self, datagram, address):
> reactor.listenMulticast(8005, MulticastServerUDP())
> when I try running more that one instance of this on the same machine I
> twisted.internet.error.CannotListenError: Couldn't listen on any:8005:
> 'Address already in use').
> So my quiestion is how can I have multiple processes listening for
> on the same machine?
> quick google for "udp twisted listen multiple" reveals
reactor.listenMulticast(5353, self, maxPacketSize=1024,