[Twisted-Python] Still fighting "twisted.names.client"
Jesus Cea
jcea at argo.es
Tue Jan 24 11:50:55 EST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I started a thread a month ago, with no luck yet.
<http://twistedmatrix.com/pipermail/twisted-python/2005-December/012162.html>
I have a reduced test case, for ease diagnosis. I hope Jean-Paul
Calderone can have a look at the issue.
My current "simple" code (not the real application, of course) is:
===== File "dns4.tac" =====
from twisted.application import service
application = service.Application("DNS test")
import sys
sys.path=["."]+sys.path
from dns4 import DomainResolver
DomainResolver().setServiceParent(application)
====================
===== File "dns4.py" =====
class resolution(object) :
def __init__(self,domain) :
global myResolver
d = myResolver.lookupMailExchange(domain,timeout=(5,))
d.addCallbacks(self._cbMailExchange, None)
def _cbMailExchange(self,results):
# Callback for MX query
print "XX",repr(results)
from twisted.internet import reactor
reactor.stop()
return
from twisted.application import service
class DomainResolver(service.Service):
def startService(self) :
global myResolver
from twisted.names import client
myResolver=client.Resolver(servers=[('127.0.0.1', 53)])
resolution("argo.es")
#resolution("argo.es")
====================
I launch the application with "twistd -n -y dns4.tac".
I get the following error: "twisted.names.dns.DNSDatagramProtocol (UDP)]
Unexpected message (32863) received from ('127.0.0.1', 53)". Apparently
Twisted is sending the DNS request (and getting the DNS answer) before
setting up the handling object.
If I uncomment the last line, to do two resolutions, the reactor is not
stoped, but an infinite loop is created, with the following (infinite)
error:
=====
2006/01/24 17:39 CET [twisted.names.dns.DNSDatagramProtocol (UDP)]
Traceback (most recent call last):
File
"/usr/local/lib/python2.4/site-packages/twisted/python/log.py", line 43,
in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File
"/usr/local/lib/python2.4/site-packages/twisted/python/context.py", line
59, in callWithContext
return self.currentContext().callWithContext(ctx, func,
*args, **kw)
File
"/usr/local/lib/python2.4/site-packages/twisted/python/context.py", line
37, in callWithContext
return func(*args,**kw)
File
"/usr/local/lib/python2.4/site-packages/twisted/internet/selectreactor.py",
line 139, in _doReadOrWrite
why = getattr(selectable, method)()
--- <exception caught here> ---
File
"/usr/local/lib/python2.4/site-packages/twisted/internet/udp.py", line
113, in doRead
data, addr = self.socket.recvfrom(self.maxPacketSize)
exceptions.AttributeError: 'Port' object has no attribute 'socket'
=====
Somebody could help me?. This issue is a showstopper in my twisted
learning :(.
Thanks in advance for your time.
- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jcea at argo.es http://www.argo.es/~jcea/ _/_/ _/_/ _/_/ _/_/ _/_/
_/_/ _/_/ _/_/_/_/_/
PGP Key Available at KeyServ _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQCVAwUBQ9Za75lgi5GaxT1NAQLNogQAhsMS+inrIuVGuOg+QuP/6qyYMPMg6GRJ
f3s9zUONp9YaPD03uysNA0UfzR4SO4BN5h40mciQUUx4YnxZl1MpSwqf8jHNYnWh
wgJ7FsY6rjYeYNke7exBteMt2eNSdffATv6hpNqPVYx8KpJGDMyN+pkxRN+cJbfy
i0lmC5EXQj8=
=LWe7
-----END PGP SIGNATURE-----
More information about the Twisted-Python
mailing list