2011-08-31 70 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