Python Forum

Full Version: Whois not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I want to get various informations about one web site (how old he is etc...). I'm using PyCharm and the following code:
import whois
domain = whois.query('mariolopes.com')
The code is from the page https://pypi.python.org/pypi/whois/0.6.4
Got severeal errors:
Error:
C:\pycharm\venv\Scripts\python.exe C:/scrapSEO/teste.py Traceback (most recent call last): File "C:/scrapSEO/teste.py", line 2, in <module> w = whois.query('mariolopes.com') File "C:\pycharm\venv\lib\site-packages\whois\__init__.py", line 50, in query pd = do_parse(do_query(d, force, cache_file, slow_down, ignore_returncode), tld) File "C:\pycharm\venv\lib\site-packages\whois\_1_query.py", line 44, in do_query _do_whois_query(dl, ignore_returncode), File "C:\pycharm\venv\lib\site-packages\whois\_1_query.py", line 58, in _do_whois_query p = subprocess.Popen(['whois', '.'.join(dl)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) File "C:\Users\ASUS PC\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "C:\Users\ASUS PC\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 997, in _execute_child startupinfo) FileNotFoundError: [WinError 2] O sistema não conseguiu localizar o ficheiro especificado Process finished with exit code 1
Any help, please?
(Mar-20-2018, 03:09 PM)mariolopes Wrote: [ -> ]
Error:
FileNotFoundError: [WinError 2] O sistema não conseguiu localizar o ficheiro especificado

What's the error say?

According to the page you linked, the module is just a wrapper around the whois command. So you might need to install that first, so it has something to wrap around.
(Mar-20-2018, 03:09 PM)mariolopes Wrote: [ -> ]
Error:
p = subprocess.Popen(['whois', '.'.join(dl)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

This module is a wrapper around the unix command whois. On a Windows System the whois command is not installed.
Maybe you can install this in your executable path somewhere: sysinternals-whois

Try this module: https://bitbucket.org/richardpenman/pywhois
If you look on pypi.python.org you'll find many whois packages.
Thank you all guys
Solved my problem. Thank you DeaD_EyE your instructions where great!