0
我想下載一個大的遠程文件,並得到一個新的錯誤..我從來沒有見過這個,我嘗試的URL,當我把它放到我的瀏覽器。dev_appserver.py中的App引擎URLError下載錯誤。 「不能分配請求的地址」
我請求URL用:
startDownloadTime = datetime.datetime.now()
logging.info("Download Start Time: "+startDownloadTime.strftime("%H:%M.%S"))
url = [MY URL]
logging.info("Starting download")
r = requests.get(url)
logging.info("Download complete")
以下是完整的跟蹤:
URLError: <urlopen error [Errno 99] Cannot assign requested address>
Traceback (most recent call last):
File "/home/username/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
req.respond()
File "/home/username/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
self.server.gateway(self).respond()
File "/home/username/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "/home/username/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 269, in __call__
return app(environ, start_response)
File "/home/username/google_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 311, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/home/username/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 149, in __call__
self._flush_logs(response.get('logs', []))
File "/home/username/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 264, in _flush_logs
apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
File "/home/username/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 94, in MakeSyncCall
return stubmap.MakeSyncCall(service, call, request, response)
File "/home/username/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 328, in MakeSyncCall
rpc.CheckSuccess()
File "/home/username/google_appengine/google/appengine/api/apiproxy_rpc.py", line 156, in _WaitImpl
self.request, self.response)
File "/home/username/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 200, in MakeSyncCall
self._MakeRealSyncCall(service, call, request, response)
File "/home/username/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 226, in _MakeRealSyncCall
encoded_response = self._server.Send(self._path, encoded_request)
File "/home/username/google_appengine/google/appengine/tools/appengine_rpc.py", line 409, in Send
f = self.opener.open(req)
File "/usr/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 99] Cannot assign requested address>
這是一個大的文件,所以我發現自己不得不使用套接字以下載它,所以這個app.yaml文件有:
env_variables:
GAE_USE_SOCKETS_HTTPLIB : 'anyvalue'
在裏面。有任何想法嗎?
編輯:只是想補充一點,這是特定於本地開發服務器,並在我的生產代碼工作。
編輯2:我想補充 - 腳本作品幾分鐘崩潰了所以好像它試圖下載一個文件之前..