Google App Engine&的urllib错误python。[Errno 11003] getaddrinfo失败 [英] urllib error of Google App Engine & python.[Errno 11003] getaddrinfo failed
问题描述
感谢您的帮助!
我想获取网站的内容,所以我使用 urllib.urlopen(url)
。
set url ='http:// localhost:8080'(tomcat page)
如果我使用Google App Engine启动器,请运行该应用程序,浏览<$ c $ c> http:// localhost :8082 ,它运作良好。
但是,如果我指定了应用程序的地址和端口:
$ $ $ $ $ $ $ c $ python``D:\程序文件\\ Google\google_appengine\dev_appserver.py-p 8082 -a 10.96.72.213 D:\pagedemon\videoareademo`
出现错误:
追溯(最近一次调用最后一次):
文件D :\程序文件\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py,行701,在__call__
handler.get(* groups)
文件D:\pagedemon\videoareademo\home.py,第76行,获得
wp = urllib.urlopen(url)
文件C:\Python27\lib\ urllib.py,第84行,在urlopen
中返回opener.open(url)
打开$ b $的文件C:\Python27\lib\urllib.py,第205行b返回getattr(self,name)(url)
文件C:\Python27\lib\urllib.py,第343行,在open_http
errcode,errmsg,headers = h.getreply ()
文件D:\Program Files\Google\google_appengine\google\appengine\dist\httplib.py,第334行,在getreply
response = self._conn.getresponse ()
文件D:\程序文件\Google\google_appengine\google\appengine\dist\httplib.py,第222行,在getresponse
截止日期= self.timeout )
文件D:\程序文件\Google\google_appengine\google\appengine\api\urlfetch.py,第263行,获取
返回rpc.get_result()
文件D:\Program Files\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py,第592行,在get_result中
返回self .__ get_result_hook(self)
文件D:\程序文件\Google\google_appengine\google\appengine\api\urlfetch.py,行365,在_get_fetch_result
中提升DownloadError(str(err) )
DownloadError:ApplicationError:2 [Errno 11003] getaddrinfo失败
最奇怪的是当我改变url形式 http:// localhost:8080 到
http://127.0.0.1:8080
,它运作良好!
我搜索了很多,但我没有找到任何好的解决方案。希望得到一些帮助!
另外,我没有配置任何 proxy.IE ,效果不错。
您的系统不一定知道本地主机应该解析为127.0.0.1。您可能需要将条目放入主机文件中。在Windows上,它位于 C:\Windows\System32\drivers\etc\hosts
Thanks for your help in advance!
I want to get contents of a website, so I use urllib.urlopen(url)
.
set url='http://localhost:8080'(tomcat page)
If I use Google App Engine Launcher, run the application, browse http://localhost:8082
, it works well.
But if I specify the address and port for the application:
python `"D:\Program Files\Google\google_appengine\dev_appserver.py" -p 8082 -a 10.96.72.213 D:\pagedemon\videoareademo`
there's something wrong:
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
The strangest thing is when I change the url form "http://localhost:8080
" to "http://127.0.0.1:8080
", it works well!
I googled a lot, but I didn't find any good solutions.Hoping for some help! Also, I didn't configure any proxy.IE works well.
Your system doesn't necessarily know that localhost should resolve to 127.0.0.1. You might need to put an entry into your hosts file. On Windows, it's located at C:\Windows\System32\drivers\etc\hosts
这篇关于Google App Engine&的urllib错误python。[Errno 11003] getaddrinfo失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!