2011-08-31 117 views
0

我试图导入pywhois module时遇到问题,我可以导入我自己的模块,但导入pywhois时仍然有问题。我在我的项目文件夹移动pywhois文件夹中,screentshot低于: enter image description here如何在gae中使用pywhois模块

这是低于进口,并呼吁statment: 进口部分:

from pywhois import * 

调用部分:

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

的问题是,它会永远抛出一个HTTP 500错误,错误文本如下:

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' 

这个错误是什么意思?为什么我可以导入我自己的模块但不能导入pywhois?

+0

避免通配符导入。 –

+1

[如何在谷歌应用引擎中使用whois]的完全重复(http://stackoverflow.com/questions/7266588/how-to-use-whois-in-google-app-engine)。请不要发布重复的问题。 –

回答

6

Google App Engine不支持socket模块,该模块使用pywhois。它可以让你import socket,但是it's an empty module