<p>我在尝试导入<a href="http://code.google.com/p/pywhois/" rel="nofollow noreferrer">pywhois module</a>时遇到问题,我可以导入自己的模块,但在导入pywhois时仍然有问题。我将pywhois文件夹移到了我的项目文件夹<strong>域中</strong>,屏幕截图如下:
<img src="https://i.stack.imgur.com/JoAvt.png" alt="enter image description here"/></p>
<p>以下是导入和调用语句:
进口部件:</p>
<pre><code>from pywhois import *
</code></pre>
<p>调用部分:</p>
^{pr2}$
<p>问题是它总是会抛出一个http 500错误,错误文本如下:</p>
<pre><code>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'
</code></pre>
<p>这个错误是什么意思?为什么我可以导入自己的模块却不能导入pywhois?在</p>