Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 谷歌应用程序引擎lxml生产错误_Google App Engine_Lxml - Fatal编程技术网

Google app engine 谷歌应用程序引擎lxml生产错误

Google app engine 谷歌应用程序引擎lxml生产错误,google-app-engine,lxml,Google App Engine,Lxml,我在谷歌应用程序引擎上使用了lxml来获取一些基本数据 它可以与SDK配合使用。当我尝试在appengine服务器上使用它时,我得到了一个好消息 IOError: Error reading file 'http://www.google.com': failed to load external entity "http://www.google.com" 我的代码看起来像 import lxml.html url = "http://www.google.com" t = lxml.htm

我在谷歌应用程序引擎上使用了lxml来获取一些基本数据

它可以与SDK配合使用。当我尝试在appengine服务器上使用它时,我得到了一个好消息

IOError: Error reading file 'http://www.google.com': failed to load external entity "http://www.google.com"
我的代码看起来像

import lxml.html
url = "http://www.google.com"
t = lxml.html.parse(url)
pagetitle = t.find.(".//title").text
self.response.out.write(pagetitle)
编辑: 我最后不得不做一个小的改变来处理,正如下面的答案所述

from google.appengine.api import urlfetch
result = urlfetch.fetch(url)
t = lxml.html.fromstring(result.content)

GAE不支持打开套接字,您应该使用
urlfetch.fetch()
获取页面内容,然后将其提供给解析器