Re: [Twisted-Python] “Unhandled Error” comes when TCP server tries to accept connections from client in twisted

2013-06-28 Thread Laurens Van Houtven
You forgot to set the protocol attribute of the factory.

factory.protocol = ChatServer
On Jun 28, 2013 10:05 PM, "jaspreet singh Kalsi" <
jaspreetsingh4...@gmail.com> wrote:

> from twisted.internet.protocol import Factory,Protocolfrom twisted.internet 
> import reactor
> class ChatServer(Protocol):
> def connectionMade(self):
> print "A Client Has Connected"
>
> factory = Factory()
> reactor.listenTCP(80,factory)print "Chat Server Started"
>
> reactor.run()
>
>
>
> the above code is running succesfully.but when I try to open TCP(telnet 
> localhost 80).
>
>
> Errors occurs :
>
> Unhandled ErrorTraceback (most recent call last):
>   File "C:\Python27\lib\site-packages\twisted\python\log.py", line 69, in 
> callWithContext
> return context.call({ILogContext: newCtx}, func, *args, **kw)
>   File "C:\Python27\lib\site-packages\twisted\python\context.py", line 118, 
> in callWithContext
> return self.currentContext().callWithContext(ctx, func, *args, **kw)
>   File "C:\Python27\lib\site-packages\twisted\python\context.py", line 81, in 
> callWithContext
> return func(*args,**kw)
>   File "C:\Python27\lib\site-packages\twisted\internet\selectreactor.py", 
> line 150, in _doReadOrWrite
> why = getattr(selectable, method)()---  ---
>   File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 718, in 
> doRead
> protocol = self.factory.buildProtocol(self._buildAddr(addr))
>   File "C:\Python27\lib\site-packages\twisted\internet\protocol.py", line 
> 104, in buildProtocol
> p = self.protocol()
> exceptions.TypeError: 'NoneType' object is not callable
>
>
>
> I m using windows 8,python 2.7 and Twisted 12.0
>
> sir/mam i have also discuss this question on stackoverflow ...but i did'nt 
> get any appropriate answer.
>
>
> please help me .
>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] “Unhandled Error” comes when TCP server tries to accept connections from client in twisted

2013-06-28 Thread jaspreet singh Kalsi
from twisted.internet.protocol import Factory,Protocolfrom
twisted.internet import reactor
class ChatServer(Protocol):
def connectionMade(self):
print "A Client Has Connected"

factory = Factory()
reactor.listenTCP(80,factory)print "Chat Server Started"

reactor.run()


the above code is running succesfully.but when I try to open
TCP(telnet localhost 80).

Errors occurs :

Unhandled ErrorTraceback (most recent call last):
  File "C:\Python27\lib\site-packages\twisted\python\log.py", line 69,
in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "C:\Python27\lib\site-packages\twisted\python\context.py", line
118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "C:\Python27\lib\site-packages\twisted\python\context.py", line
81, in callWithContext
return func(*args,**kw)
  File "C:\Python27\lib\site-packages\twisted\internet\selectreactor.py",
line 150, in _doReadOrWrite
why = getattr(selectable, method)()---  ---
  File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line
718, in doRead
protocol = self.factory.buildProtocol(self._buildAddr(addr))
  File "C:\Python27\lib\site-packages\twisted\internet\protocol.py",
line 104, in buildProtocol
p = self.protocol()
exceptions.TypeError: 'NoneType' object is not callable


I m using windows 8,python 2.7 and Twisted 12.0

sir/mam i have also discuss this question on stackoverflow ...but i
did'nt get any appropriate answer.

please help me .
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How do you write a setup.py that installs plugins?

2013-06-28 Thread Glyph

On Jun 28, 2013, at 10:30 AM, exar...@twistedmatrix.com wrote:

> On 02:50 pm, _...@lvh.io wrote:
>> Hi,
>> 
>> 
>> How are you supposed to write a setup.py that installs twistd plugins?
> 
> See http://stackoverflow.com/questions/7275295

As an open source maintainer, I should be able to tell you how setup.py 
works... however viewer, it is one of the greatest mysteries in the scientific 
world.  It would be good to raise this question on a different mailing list; 
one with lots of people with knowledge of internals of packaging tools.  If any 
of them need clarification on the Twisted side of things, I'd be happy to 
expand and improve the question.

-glyph

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] How do you write a setup.py that installs plugins?

2013-06-28 Thread exarkun

On 02:50 pm, _...@lvh.io wrote:

Hi,


How are you supposed to write a setup.py that installs twistd plugins?


See http://stackoverflow.com/questions/7275295

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] How do you write a setup.py that installs plugins?

2013-06-28 Thread Laurens Van Houtven
Hi,


How are you supposed to write a setup.py that installs twistd plugins?

I have this piece of tribal knowledge:


from setuptools.command import egg_info

def _top_level(name):
return name.split('.', 1)[0]

def _hacked_write_toplevel_names(cmd, basename, filename):
names = map(_top_level, cmd.distribution.iter_distribution_names())
pkgs = dict.fromkeys(set(names) - set(["twisted"]))
cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n')

egg_info.write_toplevel_names = _hacked_write_toplevel_names
---

But I don't actually know what's actually required, and I don't actually
know where this is documented (if at all). Plus, it looks pretty
unsanitary, and appears to introduce a dependency to setuptools.

So, how am I supposed to do this?

Thanks in advance
lvh
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python