我的示例代码是
import dnspython as dns
import dns.resolver
result = dns.resolver.query('google.com', 'A')
for ipval in result:
print('IP', ipval.to_text())
这给了我一个错误
dns.resolver.NoResolverConfiguration: Resolver configuration could not be read or specified no nameservers.
/etc/resolv.conf包含“1.1.1.1”,除此之外没有其他内容,netplan名称服务器也设置为1.1.1.1
机器正在ubuntu 20.04上运行python 3.8.5
为什么它会给我这个错误?我如何解决它
明白了
巨大的手掌。我忘了在/etc/resolv.conf上放置名称服务器1.1.1.1,而不是1.1.1
因此,事实上,配置是错误的
相关问题 更多 >
编程相关推荐