[Twisted-Python] Help With Twisted as a Client (newbie warning)

Steve Milner smilner at trinityz.com
Tue Mar 8 08:42:56 EST 2005


Hello List,

I'm still stuck at mainly the same point. I've noticed that inside the 
class itself I can call transport.write and it writes to the server, but 
if I try to access it outside the class (even through a function) it 
gives an attribute error (AttributeError: 'NoneType' object has no 
attribute 'write'). I'm a bit lost. All help is much appreciated.

---
factory = CUClientFactory()

factory.clients = []
sslFactory = ClientContextFactory()
factory.protocol = xmlclient
client = xmlclient()
application = service.Application(client)
reactor.connectSSL("server", 1026, factory, sslFactory)

client.transport.write('ya')

reactor.run()
----

Itamar Shtull-Trauring wrote:

>On Thu, 2005-02-17 at 11:25 -0500, Steve Milner wrote:
>
>  
>
>>factory.clients = []
>>sslFactory = ClientContextFactory()
>>application = service.Application("xmlclient")
>>reactor.connectSSL("__example__.com", 1026, factory, sslFactory)
>></snip>
>>
>>Is there a way I can access xmlxlient inside application?
>>    
>>
>
>The application object is not used for that (and certainly can't be used
>if it doesn't have a reference to the factory, it doesn't magically get
>one). Hand a reference to the factory to whichever objects wishes to
>control the instance
>  
>




More information about the Twisted-Python mailing list