ModuleNotFoundError: No module named 'dnspython'
Question:
I am trying to import the module dnspython
in a python 3.6 script using import dnspython
.
pip3 freeze
shows that the package is installed but I keep getting the error ModuleNotFoundError: No module named 'dnspython'
I have tried:
pip3 install dnspython
- uninstalling and reinstalling with pip3
pip3 install git+https://github.com/rthalley/dnspython
- Cloning the package from github and installing with
sudo python setup.py install
pip3 install dnspython3
and using import dnspython3
in the script
- Copying the dns folder of the cloned package in the site-packages folder
I am aware of this post for python 2.7 but none of the solutions worked.
Answers:
The problem was import dnspython
. Changing it into import dns
worked fine.
Some test code:
import dns
result = dns.resolver.query('google.com', 'A')
for ipval in result:
print('IP', ipval.to_text())
# Output: IP {your ip}
It worked for me (Python 3.8.5):
pip install dnspython3
code:
import dns
from dns import resolver
result = resolver.resolve('google.com')
for ipval in result:
print('IP', ipval.to_text())
IS DNSPython safe to use or if any vulnerablities?
I am trying to import the module dnspython
in a python 3.6 script using import dnspython
.
pip3 freeze
shows that the package is installed but I keep getting the error ModuleNotFoundError: No module named 'dnspython'
I have tried:
pip3 install dnspython
- uninstalling and reinstalling with pip3
pip3 install git+https://github.com/rthalley/dnspython
- Cloning the package from github and installing with
sudo python setup.py install
pip3 install dnspython3
and usingimport dnspython3
in the script- Copying the dns folder of the cloned package in the site-packages folder
I am aware of this post for python 2.7 but none of the solutions worked.
The problem was import dnspython
. Changing it into import dns
worked fine.
Some test code:
import dns
result = dns.resolver.query('google.com', 'A')
for ipval in result:
print('IP', ipval.to_text())
# Output: IP {your ip}
It worked for me (Python 3.8.5):
pip install dnspython3
code:
import dns
from dns import resolver
result = resolver.resolve('google.com')
for ipval in result:
print('IP', ipval.to_text())
IS DNSPython safe to use or if any vulnerablities?