lxml

Python 2.7 on Google App Engine, cannot use lxml.etree

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been trying to use html5lib with lxml on python 2.7 in google app engine. But when I run the following code, it gives me an error saying "NameError: global name 'etree' is not defined". Is it not possible to use lxml.etree on google app engine? or am I missing something? app.yaml application: testsite version: 1 runtime: python27 api_version: 1 threadsafe: false handlers: - url: /.* script: index.py libraries: - name: lxml version: "2.3" # I thought this would allow me to use lxml.etree index.py from testhandler import TestHandler

How to install lxml into virtualenv from the local system?

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There is lxml module installed on my system (debian package python-lxml , for python 2.6), also I'm using virtualenv based on python2.6, installed with flag --no-site-packages . Is it possible to install lxml inside virtual environment without compilation using some standard tools (pip, easy_install etc) and already install lxml binary files from the base system? P.S. I can, of course, manually create symlinks/copy files but don't like this method. 回答1: You may create required symlinks automatically by bootstrap script . 文章来源: How to install

Cannot install lxml on windows, fatal error C1083: Cannot open include file: 'libxml/xmlversion.h'

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Python noob, please bear with me. I used python installer for v3.5.1 from www.python.org. My intent was to use Scrapy to run some scripts. pip install scrapy failed, as did easy_install scrapy and others. I traced the error to a faulty install of lxml. Here is the error log. I've even tried easy_installing libxml2, I'm not sure how to proceed. Building lxml version 3.5.0. Building without Cython. ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n" ** make sure the development

Python XML Parsing [duplicate]

帅比萌擦擦* 提交于 2019-12-03 03:00:25
This question already has an answer here: How do I parse XML in Python? 14 answers *Note: lxml will not run on my system. I was hoping to find a solution that does not involve lxml. I have gone through some of the documentation around here already, and am having difficulties getting this to work how I would like to. I would like to parse some XML file that looks like this: <dict> <key>1375</key> <dict> <key>Key 1</key><integer>1375</integer> <key>Key 2</key><string>Some String</string> <key>Key 3</key><string>Another string</string> <key>Key 4</key><string>Yet another string</string> <key>Key

Lxml html xpath context

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using lxml to parse a HTML file and I'd like to know how can I set the context of xpath search. What I mean I that I have a node element and want to make xpath search only inside this node as if it was the root one. For example, I have a form node and xpath search //input return only inputs of the given form as opposed to all inputs of all forms on the page. How can I do that? I've found some xpath context docs here , but it doesn't seems to be quite what I want. 回答1: XPath expression //input will match all input elements,

Python import statement semantics

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having difficulty understanding the import statement and its variations. Suppose I'm using the lxml module for scraping websites. The following examples show... from lxml.html import parse parse( 'http://somesite' ) ...Google's python style guide prefers the basic import statement, to preserve the namespaces. I'd prefer to do that, but when I try this: import lxml lxml.html.parse( 'http://somesite' ) ...then I get the following error message: AttributeError: 'module' object has no attribute 'html' Can anyone help me understand what is

bs4.FeatureNotFound: Couldn&#039;t find a tree builder with the features you requested: lxml. Do you need to install a parser library?

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: ... soup = BeautifulSoup(html, "lxml") File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 152, in __init__ % ",".join(features)) bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? The above outputs on my Terminal. I am on Mac OS 10.7.x. I have Python 2.7.1, and followed this tutorial to get Beautiful Soup and lxml, which both installed successfully and work with a separate test file located here . In the Python script that causes this error, I have

lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a perplexing problem. I have used mac version 10.9, anaconda 3.4.1, python 2.7.6. Developing web application with python-amazon-product-api. i have overcome an obstacle about installing lxml, referencing clang error: unknown argument: '-mno-fused-madd' (python package installation failure) . but another runtime error happened. Here is the output from webbrowser. Exception Type : ImportError Exception Value : dlopen ( /Users/ User_Name / Documents / App_Name / lib / python2 . 7 / site - packages / lxml / etree . so , 2 ):

Installing easy_install… to get to installing lxml

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've come to grips with the fact that ElementTree isn't going to do what I want it to do. I've checked out the documentation for lxml, and it appears that it will serve my purposes. To get lxml, I need to get easy_install. So I downloaded it from here , and put it in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ . Then I went to that folder, and ran sh setuptools-0.6c11-py2.6.egg . That installed successfully. Then I got excited because I thought the whole point of easy_install was that I could then just

finding elements by attribute with lxml

情到浓时终转凉″ 提交于 2019-12-03 02:34:50
问题 I need to parse a xml file to extract some data. I only need some elements with certain attributes, here's an example of document: <root> <articles> <article type="news"> <content>some text</content> </article> <article type="info"> <content>some text</content> </article> <article type="news"> <content>some text</content> </article> </articles> </root> Here I would like to get only the article with the type "news". What's the most efficient and elegant way to do it with lxml? I tried with the