0

On google Colaboratory I try to implement a whois script to get informations about spammers.

I do the following :

!pip install python-whois-extended
import whois

Then to test what's inside the module I do the following

dir(whois)

I get this result :

['CACHE_FILE',
 'Domain',
 'SLOW_DOWN',
 'TLD_RE',
 '_1_query',
 '_2_parse',
 '_3_adjust',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 'do_parse',
 'do_query',
 'query',
 'tld_regexpr']

But when I try to actually try to use it :

whois.query('myDomain.fr')

I get this error :

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-3-f1614a16f565> in <module>()
----> 1 whois.query('myDomain.fr')

4 frames
/usr/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1549                         if errno_num == errno.ENOENT:
   1550                             err_msg += ': ' + repr(err_filename)
-> 1551                     raise child_exception_type(errno_num, err_msg, err_filename)
   1552                 raise child_exception_type(err_msg)
   1553 

FileNotFoundError: [Errno 2] No such file or directory: 'whois': 'whois'

Am I missing something ? What am I doing wrong ?

Arnaud
  • 141
  • 2
  • 9

1 Answers1

0

The package rely on the whois command - It seems the command is not installed in your system.

You can install the whois command with your system package manager.For example: if you use Ubuntu try:

apt install whois
napuzba
  • 6,033
  • 3
  • 21
  • 32
  • I tried adding "!pip install whois" in the first line but still get the same problem. Am working online, on the google colaboratory. – Arnaud Jul 02 '21 at 13:27
  • `!pip install python-whois` worked for me. Reference: https://stackoverflow.com/questions/29773003/check-whether-domain-is-registered/29773604#29773604 – mig001 May 07 '23 at 19:11