[Twisted-Python] Twisted Names strings

Angelo Dell'Aera angelo.dellaera at gmail.com
Thu Jan 17 11:22:26 EST 2013


After updating Twisted to 12.3.0 I started getting errors like the following one

2013-01-17 14:38:23+0100 [-]   File "/usr/lib64/python2.7/site-packages/twisted/names/common.py", line 93, in lookupAddress
2013-01-17 14:38:23+0100 [-]     return self._lookup(name, dns.IN, dns.A, timeout)
2013-01-17 14:38:23+0100 [-]   File "/usr/lib64/python2.7/site-packages/twisted/names/client.py", line 384, in _lookup
2013-01-17 14:38:23+0100 [-]     d = self.queryUDP([dns.Query(name, type, cls)], timeout)
2013-01-17 14:38:23+0100 [-]   File "/usr/lib64/python2.7/site-packages/twisted/names/dns.py", line 484, in __init__
2013-01-17 14:38:23+0100 [-]     self.name = Name(name)
2013-01-17 14:38:23+0100 [-]   File"/usr/lib64/python2.7/site-packages/twisted/names/dns.py", line 357, in __init__ 
2013-01-17 14:38:23+0100 [-]     raise TypeError("%r is not a byte string" % (name,)) 
2013-01-17 14:38:23+0100 [-] TypeError: u'example.com' is not a byte string

Taking a look at documentation I found this document

http://twistedmatrix.com/documents/current/core/howto/python3.html

which states

"twisted.names.dns deals with strings with a wide range of meanings,
often several for each DNS record type. Most of these strings have
remained as byte strings, which will probably require application
updates (for the reason given in the FilePath section above). Some
strings have changed to text strings, though. Any string representing a
human readable address (for example, Record_A's address parameter) is
now a text string. Additionally, time-to-live (ttl) values given as
strings must now be given as text strings."

which seems to describe the problem I'm experiencing. 

But let me say that I'm currently using Python 2.7.3 and I was surprised in realizing 
that a simple update from a minor 12.x release was enough to disrupt my application. 

Don't you think that a kind of compatibility mechanism (maybe with a warning message) 
would have been a more gentle way of doing this transition especially for those who
are still using Python 2?

Thanks and regards,
  
-- 

Angelo Dell'Aera 'buffer'
Antifork Research, Inc.		http://buffer.antifork.org
Sysenter Honeynet Project	http://www.sysenter-honeynet.org



More information about the Twisted-Python mailing list