Skip to content Skip to sidebar Skip to footer

Attributeerror At / 'nonetype' Object Has No Attribute '_get_qnames_to_try'

UPDATE: I did some changes now I'm getting this 'NoneType' object has no attribute 'is_absolute' . . I have been working at a project where I need to print Ip address of a hostname

Solution 1:

Can you try to replace:

ip_address = dns.resolver.Resolver.resolve(search, "A")

by:

try:
    ip_address = dns.resolver.resolve(search, 'A').rrset[0].to_text()
except dns.resolver.NoAnswer:
    ip_address = 'No answer'

Post a Comment for "Attributeerror At / 'nonetype' Object Has No Attribute '_get_qnames_to_try'"