0
感謝您的幫助!Google App Engine&python的urllib錯誤[Errno 11003] getaddrinfo失敗
我想得到一個網站的內容,所以我用urllib.urlopen(url)
。
set url='http://localhost:8080'(tomcat page)
如果我使用Google App Engine啓動器,請運行應用程序,瀏覽http://localhost:8082
,它工作正常。 但是,如果我爲應用程序指定的地址和端口:
python `"D:\Program Files\Google\google_appengine\dev_appserver.py" -p 8082 -a 10.96.72.213 D:\pagedemon\videoareademo`
有些不對勁:
Traceback (most recent call last):
File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 701, in __call__
handler.get(*groups)
File "D:\pagedemon\videoareademo\home.py", line 76, in get
wp = urllib.urlopen(url)
File "C:\Python27\lib\urllib.py", line 84, in urlopen
return opener.open(url)
File "C:\Python27\lib\urllib.py", line 205, in open
return getattr(self, name)(url)
File "C:\Python27\lib\urllib.py", line 343, in open_http
errcode, errmsg, headers = h.getreply()
File "D:\Program Files\Google\google_appengine\google\appengine\dist\httplib.py", line 334, in getreply
response = self._conn.getresponse()
File "D:\Program Files\Google\google_appengine\google\appengine\dist\httplib.py", line 222, in getresponse
deadline=self.timeout)
File "D:\Program Files\Google\google_appengine\google\appengine\api\urlfetch.py", line 263, in fetch
return rpc.get_result()
File "D:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 592, in get_result
return self.__get_result_hook(self)
File "D:\Program Files\Google\google_appengine\google\appengine\api\urlfetch.py", line 365, in _get_fetch_result
raise DownloadError(str(err))
DownloadError: ApplicationError: 2 [Errno 11003] getaddrinfo failed
最奇怪的是,當我更改URL形式「http://localhost:8080
」到「http://127.0.0.1:8080
」,它效果很好!
我GOOGLE了很多,但我沒有找到任何好的解決方案。希望有一些幫助! 此外,我沒有配置任何代理.IE運作良好。
感謝您的幫助!但是爲什麼應用程序可以很好地工作,我從Google App Engine啓動程序開始?我的系統必須知道本地主機應該解析127.0.0.1,否則瀏覽http:// localhost:8080在IE中不會顯示tomcat頁面。我是對吧? – user1213298 2012-02-17 01:38:29