0

I have problems when try to import pywhois module, i can import my own module but still have troubles when import pywhois. I moved the pywhois folder in my project folder domain, the screentshot is below: enter image description here

This is the import and calling statment below: import part:

from pywhois import *

calling part:

 w = whois('hackbo.com')
 self.response.out.write(w)

The problems is it will always throw a http 500 error, error text is below:

Traceback (most recent call last):
  File "/home/li/Desktop/google_appengine/google/appengine/ext/webapp/__init__.py", line 700, in __call__
    handler.get(*groups)
  File "/home/li/Desktop/google_appengine/domain/main.py", line 43, in get
    w = whois('hackbo.com')
  File "pywhois/__init__.py", line 12, in whois
    text = nic_client.whois_lookup(None, domain, 0)
  File "pywhois/whois.py", line 157, in whois_lookup
    result = self.whois(query_arg, nichost, flags)
  File "pywhois/whois.py", line 100, in whois
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
AttributeError: 'module' object has no attribute 'socket'

What is this error means? why i could import my own module but can not import pywhois?

huangli
  • 454
  • 9
  • 26
  • 1
    Exact duplicate of [How to use whois in google app engine](http://stackoverflow.com/questions/7266588/how-to-use-whois-in-google-app-engine). Please don't post duplicate questions. – Nick Johnson Sep 05 '11 at 05:14

2 Answers2

6

Google App Engine doesn't support the socket module, which pywhois uses. It allows you to import socket, but it's an empty module.

Chris Morgan
  • 86,207
  • 24
  • 208
  • 215
-1
import whois
site = input ("Enter Site : ")
n = whois.whois (site)
print (n)

this is best whois
Enjoy that, easy.

Michał Karpacki
  • 2,588
  • 21
  • 34