1
此開發環境正常工作:urllib2.urlopen(URL)許可的應用引擎(GAE)
url = "http://www.google.com/"
return urllib2.urlopen(url)
但是,當我把它上傳到Google Apps引擎並運行它在那裏,我得到了以下錯誤:
return urllib2.urlopen(url)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 13] Permission denied>
任何人都知道爲什麼會發生這種情況?非常感謝!
可能重複:http://stackoverflow.com/questions/28081350/what-causes-urlopen-error-errno-13-permission-denied-errors – jvdh
@jvdh GAE使用的urllib2只作爲自己實現包裝(在請求由GCP資源處理),所以我不認爲這些問題是相關的。 – Ani
您是否嘗試過使用其他網址的相同代碼?最好的是非Google,非重定向和非SSL。例如:'url =「http://www.heise.de」' – Ani