From stefan_ml at behnel.de Sat May 1 16:02:43 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sat, 01 May 2010 16:02:43 +0200 Subject: [lxml-dev] Adding internal DTD entities? In-Reply-To: References: Message-ID: <4BDC3483.3010300@behnel.de> Brad Smith, 28.04.2010 20:22: > First, thanks to those responsible for lxml, it has made processing > xml in python an almost-fun experience! ;) > > I have only found one thing I need to be able to do, but of which I > can't seem to find any examples. I have entities defined in a file > that is shared by all of the files in a document (which are > xi:include'ed into the main doc). Thus, I want each document to begin > with something like: > > "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ > > %common_entities; > ]> > > The problem is that some of the files in the doc are auto-generated by > a python/lxml pre-processing script, and I can't figure out how to > have lxml insert that entity definition into the doctype declaration. There isn't currently a way to inject an internal DTD subset. Your best bet is to either write out the DTD before the serialised document (easy if you serialise to UTF-8), or to parse a new empty document with the above internal subset and replace its content by your own XML tree, then serialise that. Not exactly the most beautiful solutions, but they usually work well. Stefan From dkuhlman at rexx.com Mon May 3 05:35:15 2010 From: dkuhlman at rexx.com (Dave Kuhlman) Date: Sun, 2 May 2010 20:35:15 -0700 Subject: [lxml-dev] examine XSD xml schema In-Reply-To: <4BD6D231.4030802@gmx.ch> References: <4BD6D231.4030802@gmx.ch> Message-ID: <20100503033515.GA73025@cutter.rexx.com> On Tue, Apr 27, 2010 at 02:01:53PM +0200, Michael Konietzny wrote: [snip] > > I'm then able to use schema_document (which is etree._Element) to go > through the schema as an XML document. But since etree.fromstring (at > least it seams like that) expects a XML document the xsd:include > elements are not processed. > > The problem is currently solved by parsing the first schema document, > then load the include elements and then insert them one by one into > the main document by hand: You might be interested in looking at process_includes.py. It is part of the generateDS.py package. It reads and parses an XML Schema (using lxml, of course) and replaces the include and import elements in that document with the included document. process_includes.py is imported and used by generateDS.py itself, but you can also run it from the command line. You can find the latest version of generateDS.py here: http://www.rexx.com/~dkuhlman/#generateds-py-generate-python-data-bindings-from-xml-schema or at the Python project index: http://pypi.python.org/pypi If you try it, let me know if you have questions, suggestions, etc.. - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman From friedel at translate.org.za Mon May 3 12:31:25 2010 From: friedel at translate.org.za (F Wolff) Date: Mon, 03 May 2010 12:31:25 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <1272572290.9033.16335.camel@localhost.localdomain> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> Message-ID: <1272882685.9033.44161.camel@localhost.localdomain> Op Do, 2010-04-29 om 22:18 +0200 skryf F Wolff: > Op Di, 2010-04-06 om 15:41 -0400 skryf Stephen Graham: > > I am trying to go down the learning curve on lxml. > > > > I tried to follow the install instructions to install lxml on my MacOS > > > > As root, I did: > > STATIC_DEPS=true easy_install lxml > > > > The install chugged away, but eventually failed: > > > > ... > > > > Undefined symbols for architecture i386: > > "_gzdirect", referenced from: > > ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) > > ld: symbol(s) not found for architecture i386 > > collect2: ld returned 1 exit status > > Undefined symbols for architecture ppc: > > "_gzdirect", referenced from: > > ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) > > ld: symbol(s) not found for architecture ppc > > collect2: ld returned 1 exit status > > lipo: can't open input file: /var/tmp//ccsmIZu8.out (No such file or > > directory) > > make[2]: *** [xmllint] Error 1 > > make[1]: *** [all-recursive] Error 1 > > make: *** [all] Error 2 > > Traceback (most recent call last): > > File "/usr/bin/easy_install", line 8, in > > load_entry_point('setuptools==0.6c7', 'console_scripts', > > 'easy_install')() > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 1670, in > > main > > with_ei_usage(lambda: > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 1659, in > > with_ei_usage > > return f() > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 1674, in > > > > distclass=DistributionWithoutHelpCommands, **kw > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > > python2.5/distutils/core.py", line 151, in setup > > dist.run_commands() > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > > python2.5/distutils/dist.py", line 974, in run_commands > > self.run_command(cmd) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ > > python2.5/distutils/dist.py", line 994, in run_command > > cmd_obj.run() > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 211, in run > > self.easy_install(spec, not self.no_deps) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 446, in > > easy_install > > return self.install_item(spec, dist.location, tmpdir, deps) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 471, in > > install_item > > dists = self.install_eggs(spec, download, tmpdir) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 655, in > > install_eggs > > return self.build_and_install(setup_script, setup_base) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 930, in > > build_and_install > > self.run_setup(setup_script, setup_base, args) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/command/easy_install.py", line 919, in > > run_setup > > run_setup(setup_script, args) > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/sandbox.py", line 27, in run_setup > > lambda: execfile( > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/sandbox.py", line 63, in run > > return func() > > File "/System/Library/Frameworks/Python.framework/Versions/2.5/ > > Extras/lib/python/setuptools/sandbox.py", line 29, in > > {'__file__':setup_script, '__name__':'__main__'} > > File "setup.py", line 119, in > > File "/tmp/easy_install-XVh5wp/lxml-2.2.6/setupinfo.py", line 50, > > in ext_modules > > File "/tmp/easy_install-XVh5wp/lxml-2.2.6/buildlibxml.py", line > > 208, in build_libxml2xslt > > File "/tmp/easy_install-XVh5wp/lxml-2.2.6/buildlibxml.py", line > > 158, in call_subprocess > > Exception: Command "make" returned code 2 > > > > > > Any thing obvious jump out at anyone that I might have missed? > > > > thanks in advance > > sgg > > Steve Graham > > Hi Steve > > I just saw this same issue on someone else's computer (OSX 10.5). Did > you ever manage solve this? We finally managed to get a build going by forcing an older version of libxml2 (2.7.3). Why would the build succeed with 2.7.3 but not with 2.7.7? This is with the system python (2.5) if it matters. Friedel -- Recently on my blog: http://translate.org.za/blogs/friedel/en/content/how-should-we-do-high-contrast-application-icons From stefan_ml at behnel.de Mon May 3 13:13:08 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Mon, 03 May 2010 13:13:08 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <1272882685.9033.44161.camel@localhost.localdomain> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> Message-ID: <4BDEAFC4.7040103@behnel.de> F Wolff, 03.05.2010 12:31: > Op Do, 2010-04-29 om 22:18 +0200 skryf F Wolff: >> Op Di, 2010-04-06 om 15:41 -0400 skryf Stephen Graham: >>> I am trying to go down the learning curve on lxml. >>> >>> I tried to follow the install instructions to install lxml on my MacOS >>> >>> As root, I did: >>> STATIC_DEPS=true easy_install lxml >>> >>> The install chugged away, but eventually failed: >>> >>> ... >>> >>> Undefined symbols for architecture i386: >>> "_gzdirect", referenced from: >>> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) >>> ld: symbol(s) not found for architecture i386 >>> collect2: ld returned 1 exit status >>> Undefined symbols for architecture ppc: >>> "_gzdirect", referenced from: >>> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) >>> ld: symbol(s) not found for architecture ppc >>> collect2: ld returned 1 exit status >>> lipo: can't open input file: /var/tmp//ccsmIZu8.out (No such file or >>> directory) >> >> I just saw this same issue on someone else's computer (OSX 10.5). Did >> you ever manage solve this? > > We finally managed to get a build going by forcing an older version of > libxml2 (2.7.3). Why would the build succeed with 2.7.3 but not with > 2.7.7? This is with the system python (2.5) if it matters. Did you make sure that you used the same compiler/linker flags in both cases? The error above suggests that the compiler was not correctly configured, maybe it tried to build for both i386 and ppc (likely because CPython was built for both), but only an i386 build of libxml2 was available for linking. Stefan From sgg at ci.uchicago.edu Mon May 3 13:32:26 2010 From: sgg at ci.uchicago.edu (Stephen Graham) Date: Mon, 3 May 2010 07:32:26 -0400 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <1272882685.9033.44161.camel@localhost.localdomain> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> Message-ID: and fwiw, I did not succeed in getting lxml built on my Mac, and as with F Wolff, I use the system Python. I will give 2.7.3 a shot tho. sgg On May 3, 2010, at 6:31 AM, F Wolff wrote: > Op Do, 2010-04-29 om 22:18 +0200 skryf F Wolff: >> Op Di, 2010-04-06 om 15:41 -0400 skryf Stephen Graham: >>> I am trying to go down the learning curve on lxml. >>> >>> I tried to follow the install instructions to install lxml on my >>> MacOS >>> >>> As root, I did: >>> STATIC_DEPS=true easy_install lxml >>> >>> The install chugged away, but eventually failed: >>> >>> ... >>> >>> Undefined symbols for architecture i386: >>> "_gzdirect", referenced from: >>> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) >>> ld: symbol(s) not found for architecture i386 >>> collect2: ld returned 1 exit status >>> Undefined symbols for architecture ppc: >>> "_gzdirect", referenced from: >>> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) >>> ld: symbol(s) not found for architecture ppc >>> collect2: ld returned 1 exit status >>> lipo: can't open input file: /var/tmp//ccsmIZu8.out (No such file or >>> directory) >>> make[2]: *** [xmllint] Error 1 >>> make[1]: *** [all-recursive] Error 1 >>> make: *** [all] Error 2 >>> Traceback (most recent call last): >>> File "/usr/bin/easy_install", line 8, in >>> load_entry_point('setuptools==0.6c7', 'console_scripts', >>> 'easy_install')() >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 1670, in >>> main >>> with_ei_usage(lambda: >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 1659, in >>> with_ei_usage >>> return f() >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 1674, in >>> >>> distclass=DistributionWithoutHelpCommands, **kw >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> lib/ >>> python2.5/distutils/core.py", line 151, in setup >>> dist.run_commands() >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> lib/ >>> python2.5/distutils/dist.py", line 974, in run_commands >>> self.run_command(cmd) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> lib/ >>> python2.5/distutils/dist.py", line 994, in run_command >>> cmd_obj.run() >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 211, >>> in run >>> self.easy_install(spec, not self.no_deps) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 446, in >>> easy_install >>> return self.install_item(spec, dist.location, tmpdir, deps) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 471, in >>> install_item >>> dists = self.install_eggs(spec, download, tmpdir) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 655, in >>> install_eggs >>> return self.build_and_install(setup_script, setup_base) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 930, in >>> build_and_install >>> self.run_setup(setup_script, setup_base, args) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/command/easy_install.py", line 919, in >>> run_setup >>> run_setup(setup_script, args) >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/sandbox.py", line 27, in run_setup >>> lambda: execfile( >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/sandbox.py", line 63, in run >>> return func() >>> File "/System/Library/Frameworks/Python.framework/Versions/2.5/ >>> Extras/lib/python/setuptools/sandbox.py", line 29, in >>> {'__file__':setup_script, '__name__':'__main__'} >>> File "setup.py", line 119, in >>> File "/tmp/easy_install-XVh5wp/lxml-2.2.6/setupinfo.py", line 50, >>> in ext_modules >>> File "/tmp/easy_install-XVh5wp/lxml-2.2.6/buildlibxml.py", line >>> 208, in build_libxml2xslt >>> File "/tmp/easy_install-XVh5wp/lxml-2.2.6/buildlibxml.py", line >>> 158, in call_subprocess >>> Exception: Command "make" returned code 2 >>> >>> >>> Any thing obvious jump out at anyone that I might have missed? >>> >>> thanks in advance >>> sgg >>> Steve Graham >> >> Hi Steve >> >> I just saw this same issue on someone else's computer (OSX 10.5). Did >> you ever manage solve this? > > > We finally managed to get a build going by forcing an older version of > libxml2 (2.7.3). Why would the build succeed with 2.7.3 but not with > 2.7.7? This is with the system python (2.5) if it matters. > > Friedel > > > > -- > Recently on my blog: > http://translate.org.za/blogs/friedel/en/content/how-should-we-do-high-contrast-application-icons > > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev Steve Graham sgg at ci.uchicago.edu From friedel at translate.org.za Mon May 3 15:56:55 2010 From: friedel at translate.org.za (F Wolff) Date: Mon, 03 May 2010 15:56:55 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <4BDEAFC4.7040103@behnel.de> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> Message-ID: <1272895015.9033.45322.camel@localhost.localdomain> Op Ma, 2010-05-03 om 13:13 +0200 skryf Stefan Behnel: > F Wolff, 03.05.2010 12:31: > > Op Do, 2010-04-29 om 22:18 +0200 skryf F Wolff: > >> Op Di, 2010-04-06 om 15:41 -0400 skryf Stephen Graham: > >>> I am trying to go down the learning curve on lxml. > >>> > >>> I tried to follow the install instructions to install lxml on my MacOS > >>> > >>> As root, I did: > >>> STATIC_DEPS=true easy_install lxml > >>> > >>> The install chugged away, but eventually failed: > >>> > >>> ... > >>> > >>> Undefined symbols for architecture i386: > >>> "_gzdirect", referenced from: > >>> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) > >>> ld: symbol(s) not found for architecture i386 > >>> collect2: ld returned 1 exit status > >>> Undefined symbols for architecture ppc: > >>> "_gzdirect", referenced from: > >>> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) > >>> ld: symbol(s) not found for architecture ppc > >>> collect2: ld returned 1 exit status > >>> lipo: can't open input file: /var/tmp//ccsmIZu8.out (No such file or > >>> directory) > >> > >> I just saw this same issue on someone else's computer (OSX 10.5). Did > >> you ever manage solve this? > > > > We finally managed to get a build going by forcing an older version of > > libxml2 (2.7.3). Why would the build succeed with 2.7.3 but not with > > 2.7.7? This is with the system python (2.5) if it matters. > > Did you make sure that you used the same compiler/linker flags in both > cases? The error above suggests that the compiler was not correctly > configured, maybe it tried to build for both i386 and ppc (likely because > CPython was built for both), but only an i386 build of libxml2 was > available for linking. > > Stefan I used the same command without customising any of the compiler or linker flags. The same version of lxml (latest, 2.2.6) with the differing versions of libxml2 produced the different results. In both cases it was a static build as recommended by the installation documentation. I don't have access to the original machine, but just duplicated the issue with clean lxml from SVN trunk. The commands were just python setup.py clean python setup.py build --static-deps with no files modified. Does this help? Friedel -- Recently on my blog: http://translate.org.za/blogs/friedel/en/content/how-should-we-do-high-contrast-application-icons From mike at it-loops.com Mon May 3 20:34:29 2010 From: mike at it-loops.com (Michael Guntsche) Date: Mon, 3 May 2010 20:34:29 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <1272895015.9033.45322.camel@localhost.localdomain> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> Message-ID: <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> On May 3, 2010, at 15:56, F Wolff wrote: > I don't have access to the original machine, but just duplicated the > issue with clean lxml from SVN trunk. The commands were just > python setup.py clean > python setup.py build --static-deps > with no files modified. > > Does this help? The problem appears to be a botched 10.4 SDK. The library under /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libz.dylib does not have a gzdirect although the header file says otherwise. The one in the 10.5 sdk and under /usr/lib have the function. As a test you could try moving the dylib from 10.5 to 10.4 and see if it works. I do not know how to fix that in an easy way that does not break universal builds though. Kind regards, Michael -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2494 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100503/60f5da70/attachment.bin From mike at it-loops.com Mon May 3 20:52:17 2010 From: mike at it-loops.com (Michael Guntsche) Date: Mon, 3 May 2010 20:52:17 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> Message-ID: On May 3, 2010, at 20:34, Michael Guntsche wrote: > The problem appears to be a botched 10.4 SDK. > The library under /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libz.dylib > does not have a gzdirect although the header file says otherwise. > The one in the 10.5 sdk and under /usr/lib > have the function. > As a test you could try moving the dylib from 10.5 to 10.4 and see > if it works. > I do not know how to fix that in an easy way that does not break > universal builds though. Answering my own mail. Removing isysroot from the CFLAGS and LDFLAGS fixes the problem. I think this also means that the resulting lib most likely won't work under 10.4. I wonder if this is needed though. /Mike From fdrake at acm.org Tue May 4 18:09:59 2010 From: fdrake at acm.org (Fred Drake) Date: Tue, 4 May 2010 12:09:59 -0400 Subject: [lxml-dev] Relax NG validation question Message-ID: I've been using jing to validate documents against a schema written in the RelaxNG compact syntax. I'd like to use lxml to validate instead of using jing. After converting the schema to the XML syntax using trang, I'm loading the schema like so: >>> import lxml.etree >>> doc = lxml.etree.parse("top.rng") >>> schema = lxml.etree.RelaxNG(doc) Traceback (most recent call last): File "", line 1, in File "relaxng.pxi", line 84, in lxml.etree.RelaxNG.__init__ (src/lxml/lxml.etree.c:114962) RelaxNGParseError: xmlRelaxNG: include middle.rng has a define anyElement but not the included grammar, line 9 I suspect something about the include structure of my schema is causing lxml this heartburn. I've reproduced this with a cut-down version of the schema, but I'm using the same include structure as the original, since I suspect that's essential (and I'd like to retain that instead of restructuring the actual schema). My schema is written as three files (attached): base.rng This is really just a very-slightly-modified copy of the Atom schema. It defines an "anyElement" pattern. This can be loaded on it's own. middle.rng This includes and extends base.rng. It makes no specific mention of the "anyElement" pattern. This can be loaded on it's own. top.rng This is the top-level schema that I actually care about validating; it overrides the "anyElement" pattern as part of the include of middle.rng. Building the RelaxNG object from this document causes the exception shown above. Any ideas? I'm using Python 2.6.5 and lxml 2.2.6, libxml2 2.7.7, and libxslt 1.1.26. -Fred -- Fred L. Drake, Jr. "Chaos is the score upon which reality is written." --Henry Miller -------------- next part -------------- A non-text attachment was scrubbed... Name: base.rng Type: application/octet-stream Size: 855 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100504/7ff80a87/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: middle.rng Type: application/octet-stream Size: 462 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100504/7ff80a87/attachment-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: top.rng Type: application/octet-stream Size: 536 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100504/7ff80a87/attachment-0002.obj From relativityguy at gmail.com Tue May 4 20:36:46 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Wed, 5 May 2010 00:06:46 +0530 Subject: [lxml-dev] Newline while outputting a XML file. Message-ID: Hello everyone. I am developing a Python application that interprets/ writes XML files and I will be using lxml for this. However when writing to the XML using lxml, how can I force it to do a newline on every new tag? What I mean by this is, consider the following code: http://codepad.org/boEQxxqU The output of this code is: Trying I want the output to be: Trying Sorry if this question is too noobish, but I am just beginning. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100505/c83d0971/attachment.htm From ovnicraft at gmail.com Tue May 4 20:57:16 2010 From: ovnicraft at gmail.com (Ovnicraft) Date: Tue, 4 May 2010 13:57:16 -0500 Subject: [lxml-dev] Newline while outputting a XML file. In-Reply-To: References: Message-ID: 2010/5/4 Lashkara Singh > Hello everyone. > > I am developing a Python application that interprets/ writes XML files and > I will be using lxml for this. > > However when writing to the XML using lxml, how can I force it to do a > newline on every new tag? What I mean by this is, consider the following > code: http://codepad.org/boEQxxqU > > The output of this code is: Trying > > I want the output to be: > > > > Trying > > > > Sorry if this question is too noobish, but I am just beginning. > pretty_print=True does it. etree.tostring(yourtree, pretty_print=True) > > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev > > -- Cristian Salamea CEO GnuThink Software Labs Software Libre / Open Source (+593-8) 4-36-44-48 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100504/db8f3d4d/attachment.htm From relativityguy at gmail.com Tue May 4 21:11:59 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Wed, 5 May 2010 00:41:59 +0530 Subject: [lxml-dev] Newline while outputting a XML file. In-Reply-To: References: Message-ID: Thank you everyone. It works. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100505/5dd4c7f9/attachment.htm From relativityguy at gmail.com Tue May 4 21:52:46 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Wed, 5 May 2010 01:22:46 +0530 Subject: [lxml-dev] Newline while outputting a XML file. In-Reply-To: References: Message-ID: Sorry for reopening this thread and not noticing earlier, but etree.tostring returns a string. I need to output the 'pretty printed' XML to a file and so I did a .write() I was wondering: 1) Is it acceptable to output a XML file like this, i.e. using a string instead of the etree.write method? 2) When outputting files, what is preferred: the normal way lxml does it or pretty printing it? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100505/0beb6bad/attachment-0001.htm From jholg at gmx.de Tue May 4 22:45:33 2010 From: jholg at gmx.de (jholg at gmx.de) Date: Tue, 04 May 2010 22:45:33 +0200 Subject: [lxml-dev] Newline while outputting a XML file. In-Reply-To: References: Message-ID: <20100504204533.41530@gmx.net> Hi, > 1) Is it acceptable to output a XML file like this, i.e. using a string > instead of the etree.write method? Yes, why not? Still, I think the straightforward way would be to use the _ElementTree.write() method which also supports the pretty_print keyword. > 2) When outputting files, what is preferred: the normal way lxml does it > or > pretty printing it? Depends on your use case. If space is of concern you wouldn't want to pretty-print and add add extra, non-significant whitespace. If whitespace in the document is of significance you wouldn't want to garble it by adding extra whitespace. If (human) readability is your prime concern you probably want to pretty-print. Holger -- GRATIS f?r alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 From relativityguy at gmail.com Tue May 4 22:59:53 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Wed, 5 May 2010 02:29:53 +0530 Subject: [lxml-dev] Newline while outputting a XML file. In-Reply-To: <20100504204533.41530@gmx.net> References: <20100504204533.41530@gmx.net> Message-ID: My bad, I should have looked at the documentation. Thank you. Works perfectly. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100505/a8cb2b10/attachment.htm From yogesh.tomar at gmail.com Wed May 5 10:17:27 2010 From: yogesh.tomar at gmail.com (Yogesh Tomar) Date: Wed, 5 May 2010 13:47:27 +0530 Subject: [lxml-dev] LD_LIBRARY_PATH issues Message-ID: Hi all, Here is my wierd problem. I am using lxml v 2.2.6 on a custom python (2.6.1) installation that i did for a project. I use extensively LD_LIBRARY_PATH for setting the env variables for libraries to be loaded at runtime. I am getting this error while running. ImportError: /home/tomary/Python/2.6.1_x32/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: undefined symbol: xmlSchematronSetValidStructuredErrors It seems that this error occurs because the wrong version of libxml2 is getting loaded. Though I have set up the correct version in the right place at the front of LD_LIBRARY_PATH. Please help. Regards, Yogesh Tomar -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100505/81726a13/attachment.htm From friedel at translate.org.za Wed May 5 10:44:24 2010 From: friedel at translate.org.za (F Wolff) Date: Wed, 05 May 2010 10:44:24 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> Message-ID: <1273049064.17445.2222.camel@localhost.localdomain> Op Ma, 2010-05-03 om 20:52 +0200 skryf Michael Guntsche: > On May 3, 2010, at 20:34, Michael Guntsche wrote: > > > The problem appears to be a botched 10.4 SDK. > > The library under /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libz.dylib > > does not have a gzdirect although the header file says otherwise. > > The one in the 10.5 sdk and under /usr/lib > > have the function. > > As a test you could try moving the dylib from 10.5 to 10.4 and see > > if it works. > > I do not know how to fix that in an easy way that does not break > > universal builds though. > > Answering my own mail. Removing isysroot from the CFLAGS and LDFLAGS > fixes the problem. I think this also means that the resulting lib most > likely won't work under 10.4. > I wonder if this is needed though. When I removed the isysroot, it seemed to pass the problematic part of the build (although I then hit issues with cython which I guess is unrelated). Changing 4->5 in the issysroot parameter didn't seem to work well, although the error is entirely different (error building memmove.c which seems to be part of libiconv). Friedel -- Recently on my blog: http://translate.org.za/blogs/friedel/en/content/how-should-we-do-high-contrast-application-icons From mike at it-loops.com Wed May 5 10:52:38 2010 From: mike at it-loops.com (Michael Guntsche) Date: Wed, 5 May 2010 10:52:38 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <1273049064.17445.2222.camel@localhost.localdomain> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> <1273049064.17445.2222.camel@localhost.localdomain> Message-ID: <20100505085238.GA20838@gibson.comsick.at> On 05 May 10 10:44, F Wolff wrote: > When I removed the isysroot, it seemed to pass the problematic part of > the build (although I then hit issues with cython which I guess is > unrelated). This should not affect cython in any way as far as I see it. > > Changing 4->5 in the issysroot parameter didn't seem to work well, > although the error is entirely different (error building memmove.c which > seems to be part of libiconv). I would leave it as it is, although it won't work on 10.4 anyway given the fact that libz does not seem to provide the function. Do you need 10.4 support? /Mike From friedel at translate.org.za Wed May 5 11:55:41 2010 From: friedel at translate.org.za (F Wolff) Date: Wed, 05 May 2010 11:55:41 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <20100505085238.GA20838@gibson.comsick.at> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> <1273049064.17445.2222.camel@localhost.localdomain> <20100505085238.GA20838@gibson.comsick.at> Message-ID: <1273053342.17445.2441.camel@localhost.localdomain> Op Wo, 2010-05-05 om 10:52 +0200 skryf Michael Guntsche: > On 05 May 10 10:44, F Wolff wrote: > > When I removed the isysroot, it seemed to pass the problematic part of > > the build (although I then hit issues with cython which I guess is > > unrelated). > This should not affect cython in any way as far as I see it. > > > > Changing 4->5 in the issysroot parameter didn't seem to work well, > > although the error is entirely different (error building memmove.c which > > seems to be part of libiconv). > I would leave it as it is, although it won't work on 10.4 anyway given > the fact that libz does not seem to provide the function. Do you need > 10.4 support? I don't need 10.4 support. In fact, I don't even need universal binaries (at the moment, at least). I don't know what would be best to do in lxml trunk for future releases. Should we maybe special case for OSX < 10.5 and force the use an older libxml2? Thanks for your help, Mike. Friedel -- Recently on my blog: http://translate.org.za/blogs/friedel/en/content/how-should-we-do-high-contrast-application-icons From mike at it-loops.com Wed May 5 12:26:31 2010 From: mike at it-loops.com (Michael Guntsche) Date: Wed, 5 May 2010 12:26:31 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <1273053342.17445.2441.camel@localhost.localdomain> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> <1273049064.17445.2222.camel@localhost.localdomain> <20100505085238.GA20838@gibson.comsick.at> <1273053342.17445.2441.camel@localhost.localdomain> Message-ID: <20100505102631.GA22456@gibson.comsick.at> On 05 May 10 11:55, F Wolff wrote: > I don't know what would be best to do in lxml trunk for future releases. > Should we maybe special case for OSX < 10.5 and force the use an older > libxml2? I would do the same as with iconv, build zlib as well, then we get around the we have an old lib problem. /Mike From etiffany at alum.mit.edu Wed May 5 14:08:07 2010 From: etiffany at alum.mit.edu (Eric Tiffany) Date: Wed, 5 May 2010 08:08:07 -0400 Subject: [lxml-dev] LD_LIBRARY_PATH issues In-Reply-To: References: Message-ID: Yes, I had this problem back in the day (this was on a Mac OS X platform). If I recall correctly, the problem was compounded by the fact that lxml was reporting that it had loaded the correct libxml2, but was actually not. I think part of my solution was to make sure that the right libraries were loaded at compile time; also, check this old thread for more clues: http://codespeak.net/pipermail/lxml-dev/2007-June/002528.html ET -- ___/ __ __/ etiffany at alum.mit.edu __/ / mobile +1-413-627-1778 ____/ _/ skype et01267 On May 5, 2010, at 4:17 AM, Yogesh Tomar wrote: > Hi all, > > Here is my wierd problem. I am using lxml v 2.2.6 on a custom python (2.6.1) installation that i did for a project. I use extensively LD_LIBRARY_PATH for setting the env variables for libraries to be loaded at runtime. > > I am getting this error while running. > > ImportError: /home/tomary/Python/2.6.1_x32/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: undefined symbol: xmlSchematronSetValidStructuredErrors > > It seems that this error occurs because the wrong version of libxml2 is getting loaded. Though I have set up the correct version in the right place at the front of LD_LIBRARY_PATH. > > Please help. > > Regards, > Yogesh Tomar > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100505/93d2688b/attachment.htm From pooz at gmx.net Thu May 6 02:13:15 2010 From: pooz at gmx.net (pooz) Date: Thu, 6 May 2010 00:13:15 +0000 (UTC) Subject: [lxml-dev] How to install lxml-wrapper on OS X ? Message-ID: Hello, I am trying to use the software "inkscape" with its extension inkscape2tikz (http://code.google.com/p/inkscape2tikz/) But I got an error, which needs the lxml-wrapper: "The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml" a) I was guessing, that Python is already installed on OS X? b) Where can I get this for OS X and how to install it? I would be very thankful for any advice sincerely pooz From etiffany at alum.mit.edu Thu May 6 02:21:58 2010 From: etiffany at alum.mit.edu (Eric Tiffany) Date: Wed, 5 May 2010 20:21:58 -0400 Subject: [lxml-dev] How to install lxml-wrapper on OS X ? In-Reply-To: References: Message-ID: a) Yes b) you could follow the convenient instructions just above your questions I suppose that if you are not versed in the ways of python you might be forced to read the supplementary material at the cheeseshop. Or, you could search this group (which is, sadly, a chore, unless you know how to use google to do it by specifying "lsml osx site:codespeak.net"). This topic is discussed pretty regularly. ET On May 5, 2010, at 8:13 PM, pooz wrote: > Hello, > > I am trying to use the software "inkscape" with its extension inkscape2tikz > (http://code.google.com/p/inkscape2tikz/) > > But I got an error, which needs the lxml-wrapper: > > "The fantastic lxml wrapper for libxml2 is required by inkex.py and > therefore this extension. Please download and install the latest version from > http://cheeseshop.python.org/pypi/lxml/, > or install it through your package manager by a command like: sudo apt-get > install python-lxml" > > a) I was guessing, that Python is already installed on OS X? > b) Where can I get this for OS X and how to install it? > > I would be very thankful for any advice > sincerely > pooz > > > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev From relativityguy at gmail.com Tue May 11 20:58:36 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Wed, 12 May 2010 00:28:36 +0530 Subject: [lxml-dev] Beginner's question about lxml. Message-ID: Hello everyone. I am new to Python and this is the first time I will be doing proper development using a library. I will be using lxml for my project. Since I am new, I obviously don't know the standard method of doing stuff, so as to say. My project involves a XML parser in Python. Can anyone point me to some project that implements XML parsing with lxml / Python so that I can study the source code just to see how things are done. A small and compact project would do wonders. I know how to do stuff after reading the documentation, but if I see some sample code, it would help me in understanding stuff better. I tried to find some project related to this, but I was not successful. Any inputs would be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100512/9b98c808/attachment.htm From john at nmt.edu Wed May 12 02:09:07 2010 From: john at nmt.edu (John W. Shipman) Date: Tue, 11 May 2010 18:09:07 -0600 (MDT) Subject: [lxml-dev] Beginner's question about lxml. In-Reply-To: References: Message-ID: On Wed, 12 May 2010, Lashkara Singh wrote: +-- | Can anyone point me to some project that implements XML parsing with lxml / | Python so that I can study the source code just to see how things are done. +-- Here's some documentation on using lxml with Python: http://www.nmt.edu/tcc/help/pubs/pylxml/ Here is a project I just finished, "docbookindex: ID indexer for DocBook". This program reads a DocBook-XML document and generates an outline-style list of the id attributes of all the sections. http://www.nmt.edu/tcc/projects/docbookindex/ This project illustrates a number of useful techniques: 1. Parsing a DocBook-XML document with lxml. 2. Direct generation of XSL-FO (XSL Formatting Objects) from a Python script, for rendering into a PDF file. 3. Lightweight literate programming: the DocBook document containing the documentation for the project also includes the actual source for the program. This inverts the common pydocs/JavaDocs convention that embeds documentation within the source. Here's another application that uses lxml to parse XML. This is part of my system for publishing ornithological field records on the Web. First, the external specification, which includes a Relax NG schema for the document, and specifications for the Python interface: http://www.nmt.edu/~shipman/aba/doc/ The actual implementation of the Python interface is another lightweight literate programming project: http://www.nmt.edu/~shipman/aba/doc/pyims/ Yet another literate project: this one processes an XML representation of a taxonomy of North American Birds. External specification: http://www.nmt.edu/~shipman/xnomo/ Implementation: http://www.nmt.edu/~shipman/xnomo/ims2/ I have been working with XML since the mid-1990s, using several different Python interfaces. The lxml package has made this kind of work much easier. Best regards, John Shipman (john at nmt.edu), Applications Specialist, NM Tech Computer Center, Speare 119, Socorro, NM 87801, (575) 835-5735, http://www.nmt.edu/~john ``Let's go outside and commiserate with nature.'' --Dave Farber From relativityguy at gmail.com Wed May 12 05:05:01 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Wed, 12 May 2010 08:35:01 +0530 Subject: [lxml-dev] Beginner's question about lxml. In-Reply-To: References: Message-ID: Hi John Thank you for the detailed reply. I was following your work only and allow me to congratulate you for the awesome job that you have done. You made everything look lucid and concise. I will look up all that you have mentioned. Thank you, once again. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100512/bfd1604d/attachment.htm From p.oberndoerfer at urheberrecht.org Fri May 14 00:06:16 2010 From: p.oberndoerfer at urheberrecht.org (Pascal =?iso-8859-1?Q?Obernd=F6rfer?=) Date: Fri, 14 May 2010 00:06:16 +0200 (CEST) Subject: [lxml-dev] Trying to build lxml for Mac OS X >= 10.4 with zlib and iconv Message-ID: Hello, I am trying to build lxml 2.2.6 for Python on OS X 10.4 and up (for PPC and i386) using static libs for libiconv and libz. The build seem to go fine, but I am experiencing import problems. Here are the steps I am following: - Downloading and extracting lxml 2.2.6 - Placing zlib-1.2.5, libiconv-1.13.1, libxml2-2.7.7, and libxslt-1.1.26 in the 'libs' sub folder - Using a modified 'buildlibxml.py' (based on a version originally done by Stefan) everything seems to compile without errors using: "python setup.py build \ --static-deps \ --libxml2-version=2.7.7 \ --libxslt-version=1.1.26 \ --libiconv-version=1.13.1 \ --zlib-version=1.2.5" - Looking into 'build/tmp/libxml2/lib' shows six libraries: libz.a, libiconv.a, libcharset.a, libxml2.a, libxslt.a, and libexslt.a. lipo says all are PPC+i386 (two way Universal) - After doing python setup.py install I can do "import lxml", but "import lxml.html" fails with: "ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/lxml/etree.so, 2): Symbol not found: _libiconv_close" I don't know how to proceed from here, especially as during the build of libxml2 it seems to pick up 'libiconv.a' correctly from: "libtool: link: gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -o xpath1 xpath1.o ../../.libs/libxml2.a -L/Users/admin/Desktop/lxml-2.2.6/build/tmp/libxml2/lib -lpthread -lz /Users/admin/Desktop/lxml-2.2.6/build/tmp/libxml2/lib/libiconv.a -lm" The only strange thing I can see is something lwhere it says '-liconv': "/bin/sh ../libtool --tag=CC --mode=link gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -o gjobread gjobread.o ../libxml2.la -lpthread -L/Users/admin/Desktop/lxml-2.2.6/build/tmp/libxml2/lib -lz -L/Users/admin/Desktop/lxml-2.2.6/build/tmp/libxml2/lib -liconv -lm " But I don't know how to change this. So now I am a bit lost. Any help would be very much appreciated! Thanks, Pascal PS. Let me know if I should post the modified 'buildlibxml.py'. From stefan_ml at behnel.de Fri May 14 10:17:02 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Fri, 14 May 2010 10:17:02 +0200 Subject: [lxml-dev] How to install lxml-wrapper on OS X ? In-Reply-To: References: Message-ID: <4BED06FE.7010005@behnel.de> pooz, 06.05.2010 02:13: > Hello, > > I am trying to use the software "inkscape" with its extension inkscape2tikz > (http://code.google.com/p/inkscape2tikz/) > > But I got an error, which needs the lxml-wrapper: > > "The fantastic lxml wrapper for libxml2 is required by inkex.py and > therefore this extension. Please download and install the latest version from > http://cheeseshop.python.org/pypi/lxml/, > or install it through your package manager by a command like: sudo apt-get > install python-lxml" > > a) I was guessing, that Python is already installed on OS X? > b) Where can I get this for OS X and how to install it? "apt-get install" is a Debian/Ubuntu/etc. command that won't work on OS-X. Here's how to do it: http://codespeak.net/lxml/installation.html#installation Stefan From spuzhava at purdue.edu Fri May 14 20:14:20 2010 From: spuzhava at purdue.edu (Shankaranarayanan Puzhavakath Narayanan) Date: Fri, 14 May 2010 14:14:20 -0400 Subject: [lxml-dev] Segmentation fault when building from source Message-ID: <4BED92FC.1060406@purdue.edu> Hello, I was trying to build and test lxml on "SunOS 5.10 Generic_141444-09 sun4u sparc" machine when I encountered the following issue while running the test : bash-3.00$ /usr/local/bin/make test python setup.py build_ext -i Building lxml version 2.2.6. NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available. Using build configuration of libxslt 1.1.15 Building against libxml2/libxslt in the following directory: /usr/lib running build_ext python test.py -p -v TESTED VERSION: 2.2.6 Python: (2, 4, 4, 'final', 0) lxml.etree: (2, 2, 6, 0) libxml used: (2, 6, 23) libxml compiled: (2, 6, 23) libxslt used: (1, 1, 15) libxslt compiled: (1, 1, 15) 878/1040 ( 84.4%): test_schematron_invalid_schema_empty (lxml.tests.test_schematron.ETreeSchematronTestCase)make: *** [test_inplace] Segmentation Fault (core dumped) Thanks, Shankar. From p.oberndoerfer at urheberrecht.org Fri May 14 21:04:24 2010 From: p.oberndoerfer at urheberrecht.org (Pascal =?iso-8859-1?Q?Obernd=F6rfer?=) Date: Fri, 14 May 2010 21:04:24 +0200 (CEST) Subject: [lxml-dev] Trying to build lxml for Mac OS X >= 10.4 with zlib and iconv In-Reply-To: References: Message-ID: > Hello, > > I am trying to build lxml 2.2.6 for Python on OS X 10.4 and up (for PPC > and i386) using static libs for libiconv and libz. The build seem to go > fine, but I am experiencing import problems. Using '--without-iconv' for libxml2 in 'buildlibxml.py' I can get it running. Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from lxml import etree >>> from lxml import objectify >>> from lxml import html I am still unclear about why the build will not take up libiconv.a correctly. Maybe it is trying /usr/lib/libiconv.la? This was happening the first time I tried this. Any hints still very welcome, as I would really like to have the build pick up the latest libiconv. If I should get this working in the meantime I'll report back (including eggs, of course :-). Best regards, Pascal From lfuller at premieress.com Tue May 18 01:25:57 2010 From: lfuller at premieress.com (Lacy K. Fuller) Date: Mon, 17 May 2010 23:25:57 +0000 (UTC) Subject: [lxml-dev] installing lxml on MacOS References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> Message-ID: F Wolff translate.org.za> writes: > > Op Do, 2010-04-29 om 22:18 +0200 skryf F Wolff: > > Op Di, 2010-04-06 om 15:41 -0400 skryf Stephen Graham: > > Hi Steve > > > > I just saw this same issue on someone else's computer (OSX 10.5). Did > > you ever manage solve this? > > We finally managed to get a build going by forcing an older version of > libxml2 (2.7.3). Why would the build succeed with 2.7.3 but not with > 2.7.7? This is with the system python (2.5) if it matters. > > Friedel So I'm trying to figure this out as well, running on MacOS 10.5.8 with Python 2.4 and trying to install lxml 2.2.6. I tried forcing libxml2 to 2.7.3, but I'm still getting the undefined symbols error: Undefined symbols for architecture i386: "_gzdirect", referenced from: ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status Undefined symbols for architecture ppc: "_gzdirect", referenced from: ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) ld: symbol(s) not found for architecture ppc collect2: ld returned 1 exit status lipo: can't open input file: /var/folders/jV /jVkN8QoVGXSIHfVVe53L-k+++TQ/-Tmp-//ccJ1jdEf.out (No such file or directory) make[2]: *** [xmllint] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 I'm not sure how to remove isysroot from CFLAGS and LDFLAGS as was mentioned in another post; I'm trying to use a buildout to install currently. Any suggestions anyone could make would be most appreciated. I've been banging my head against this issue for two days straight. Thanks! Lacy K. Fuller From stefan_ml at behnel.de Tue May 18 07:13:31 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 18 May 2010 07:13:31 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: <20100505102631.GA22456@gibson.comsick.at> References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> <4BDEAFC4.7040103@behnel.de> <1272895015.9033.45322.camel@localhost.localdomain> <9BCE52E1-70BA-4D14-86B1-F7B045A836D4@it-loops.com> <1273049064.17445.2222.camel@localhost.localdomain> <20100505085238.GA20838@gibson.comsick.at> <1273053342.17445.2441.camel@localhost.localdomain> <20100505102631.GA22456@gibson.comsick.at> Message-ID: <4BF221FB.4040406@behnel.de> Michael Guntsche, 05.05.2010 12:26: > On 05 May 10 11:55, F Wolff wrote: >> I don't know what would be best to do in lxml trunk for future releases. >> Should we maybe special case for OSX< 10.5 and force the use an older >> libxml2? > I would do the same as with iconv, build zlib as well, then we get > around the we have an old lib problem. This is getting way too complicated by now. Maybe lxml should just switch to requiring buildout for the libraries, instead of trying to build them by itself in its setup.py script. Stefan From stefan_ml at behnel.de Tue May 18 07:17:06 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 18 May 2010 07:17:06 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> Message-ID: <4BF222D2.9060000@behnel.de> Lacy K. Fuller, 18.05.2010 01:25: > So I'm trying to figure this out as well, running on MacOS 10.5.8 with > Python 2.4 and trying to install lxml 2.2.6. I tried forcing libxml2 to > 2.7.3 That shouldn't matter. > but I'm still getting the undefined symbols error: > > Undefined symbols for architecture i386: > "_gzdirect", referenced from: > ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) > ld: symbol(s) not found for architecture i386 > collect2: ld returned 1 exit status > Undefined symbols for architecture ppc: > "_gzdirect", referenced from: > ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) > ld: symbol(s) not found for architecture ppc > collect2: ld returned 1 exit status > lipo: can't open input file: /var/folders/jV > /jVkN8QoVGXSIHfVVe53L-k+++TQ/-Tmp-//ccJ1jdEf.out > (No such file or directory) > make[2]: *** [xmllint] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 > > I'm not sure how to remove isysroot from CFLAGS and LDFLAGS > as was mentioned in another post See buildlibxml.py. > I'm trying to use a buildout to install currently. So the above is from a buildout? Which are you using? Stefan From mike at it-loops.com Tue May 18 07:22:44 2010 From: mike at it-loops.com (Michael Guntsche) Date: Tue, 18 May 2010 07:22:44 +0200 Subject: [lxml-dev] installing lxml on MacOS In-Reply-To: References: <1F4D9F37-B9AA-440B-91CE-E185F2E1180D@ci.uchicago.edu> <1272572290.9033.16335.camel@localhost.localdomain> <1272882685.9033.44161.camel@localhost.localdomain> Message-ID: <20100518052244.GA12515@gibson.comsick.at> On 17 May 10 23:25, Lacy K. Fuller wrote: > I'm not sure how to remove isysroot from CFLAGS and LDFLAGS > as was mentioned in another post; I'm trying to use a buildout > to install currently. > > Any suggestions anyone could make would be most appreciated. > I've been banging my head against this issue for two days straight. Take a look at buildlibxml.py line 282 and 283. Just remove the isysroot there. Hope that helps, Mike From mitlox at op.pl Tue May 18 14:35:07 2010 From: mitlox at op.pl (xyz) Date: Tue, 18 May 2010 22:35:07 +1000 Subject: [lxml-dev] lxml install problem Message-ID: <20100518223507.16e909dc@wp01> Hello, I use CentOS 5.2 without root access and therefore I installed Python in my home folder. Unfortunately, I was not able to get lxml running in the following way: ------ ftp://xmlsoft.org/libxml/ cd ~/temp/libxml2-2.7.7 $ configure --prefix=/home/mit/bin/libxml2 $ make $ make install $ cd /home/mit/programs/python/lib/python2.6/site-packages $ ln -s /home/mit/bin/libxml2/lib/python2.6/site-packages/* . ---------- ftp://xmlsoft.org/libxslt/ $ ./configure --prefix=/home/mit/bin/libxslt --with-libxml-prefix=/home/mit/bin/libxml2 $ make $ make install $ cd /home/mit/programs/python/lib/python2.6/site-packages $ ln -s /home/mit/bin/libxslt/lib/python2.6/site-packages/* . --------- $ cd ~/temp/lxml-2.2.6/ $ python setup.py install --with-xml2-config=/home/mit/bin/libxml2/bin/xml2-config --with-xslt-config=/home/mit/bin/libxslt/bin/xslt-config -------- I got errors by testing the lxml in the following: $python Python 2.6.4 (r264:75706, Jan 28 2010, 14:19:59) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from lxml import etree Traceback (most recent call last): File "", line 1, in ImportError: /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: symbol xmlSchematronSetValidStructuredErrors, version LIBXML2_2.6.32 not defined in file libxml2.so.2 with link time reference >>> I also tried this: $ldd /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxslt.so.1: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: /usr/lib64/libxml2.so.2: no version information available (required by /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so) libxslt.so.1 => /usr/lib64/libxslt.so.1 (0x00002b6c90034000) libexslt.so.0 => /usr/lib64/libexslt.so.0 (0x00002b6c90269000) libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002b6c9047b000) libz.so.1 => /usr/lib64/libz.so.1 (0x00002b6c907b9000) libm.so.6 => /lib64/libm.so.6 (0x00002b6c909cd000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b6c90c50000) libc.so.6 => /lib64/libc.so.6 (0x00002b6c90e6b000) libgcrypt.so.11 => /usr/lib64/libgcrypt.so.11 (0x00002b6c911bf000) libgpg-error.so.0 => /usr/lib64/libgpg-error.so.0 (0x00002b6c9140b000) libdl.so.2 => /lib64/libdl.so.2 (0x00002b6c9160f000) /lib64/ld-linux-x86-64.so.2 (0x0000003501c00000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00002b6c91813000) What did I wrong? Thank you in advance. Best regards, From stefan_ml at behnel.de Tue May 18 14:48:47 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 18 May 2010 14:48:47 +0200 Subject: [lxml-dev] lxml install problem In-Reply-To: <20100518223507.16e909dc@wp01> References: <20100518223507.16e909dc@wp01> Message-ID: <4BF28CAF.2060608@behnel.de> xyz, 18.05.2010 14:35: > I use CentOS 5.2 without root access and therefore I installed Python > in my home folder. > > Unfortunately, I was not able to get lxml running in the following way: > ------ > ftp://xmlsoft.org/libxml/ > > cd ~/temp/libxml2-2.7.7 > $ configure --prefix=/home/mit/bin/libxml2 > $ make > $ make install > > $ cd /home/mit/programs/python/lib/python2.6/site-packages > $ ln -s /home/mit/bin/libxml2/lib/python2.6/site-packages/* . > > ---------- > ftp://xmlsoft.org/libxslt/ > > $ ./configure --prefix=/home/mit/bin/libxslt > --with-libxml-prefix=/home/mit/bin/libxml2 > > $ make > $ make install > > $ cd /home/mit/programs/python/lib/python2.6/site-packages > $ ln -s /home/mit/bin/libxslt/lib/python2.6/site-packages/* . > > --------- > $ cd ~/temp/lxml-2.2.6/ > > $ python setup.py install > --with-xml2-config=/home/mit/bin/libxml2/bin/xml2-config > --with-xslt-config=/home/mit/bin/libxslt/bin/xslt-config > -------- > > I got errors by testing the lxml in the following: > > $python > Python 2.6.4 (r264:75706, Jan 28 2010, 14:19:59) > [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> from lxml import etree > Traceback (most recent call last): > File "", line 1, in > ImportError: /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.6-py2.6-linux-x86_64.egg/lxml/etree.so: > symbol xmlSchematronSetValidStructuredErrors, version LIBXML2_2.6.32 > not defined in file libxml2.so.2 with link time reference Try passing the --auto-rpath option. Or, even better, use --static-deps=true. Stefan From mitlox at op.pl Tue May 18 15:07:39 2010 From: mitlox at op.pl (xyz) Date: Tue, 18 May 2010 23:07:39 +1000 Subject: [lxml-dev] lxml install problem In-Reply-To: <4BF28CAF.2060608@behnel.de> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> Message-ID: <20100518230739.102f38c1@wp01> On Tue, 18 May 2010 14:48:47 +0200 Stefan Behnel wrote: > Try passing the --auto-rpath option. Or, even better, use > --static-deps=true. How can I use --static-deps=true. Could give me an example please? Thank you in advance. From stefan_ml at behnel.de Tue May 18 15:20:57 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 18 May 2010 15:20:57 +0200 Subject: [lxml-dev] lxml install problem In-Reply-To: <20100518230739.102f38c1@wp01> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> <20100518230739.102f38c1@wp01> Message-ID: <4BF29439.2080703@behnel.de> xyz, 18.05.2010 15:07: > On Tue, 18 May 2010 14:48:47 +0200 > Stefan Behnel wrote: >> xyz wrote: >>> $ python setup.py install >>> --with-xml2-config=/home/mit/bin/libxml2/bin/xml2-config >>> --with-xslt-config=/home/mit/bin/libxslt/bin/xslt-config >> >> Try passing the --auto-rpath option. Or, even better, use >> --static-deps=true. > > How can I use --static-deps=true. Could give me an example please? $ python setup.py install --static-deps Stefan From stefan_ml at behnel.de Tue May 18 19:06:22 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 18 May 2010 19:06:22 +0200 Subject: [lxml-dev] Fwd: Re: installing lxml on MacOS Message-ID: <4BF2C90E.4000102@behnel.de> [Forwarding to the list] -------- Original Message -------- Subject: Re: [lxml-dev] installing lxml on MacOS Date: Tue, 18 May 2010 08:34:21 -0600 From: Lacy K. Fuller To: Stefan Behnel On May 17, 2010, at 11:17 PM, Stefan Behnel wrote: > Lacy K. Fuller, 18.05.2010 01:25: >> So I'm trying to figure this out as well, running on MacOS 10.5.8 >> with >> Python 2.4 and trying to install lxml 2.2.6. I tried forcing >> libxml2 to >> 2.7.3 > > That shouldn't matter. > > >> but I'm still getting the undefined symbols error: >> >> Undefined symbols for architecture i386: >> "_gzdirect", referenced from: >> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) >> ld: symbol(s) not found for architecture i386 >> collect2: ld returned 1 exit status >> Undefined symbols for architecture ppc: >> "_gzdirect", referenced from: >> ___xmlParserInputBufferCreateFilename in libxml2.a(xmlIO.o) >> ld: symbol(s) not found for architecture ppc >> collect2: ld returned 1 exit status >> lipo: can't open input file: /var/folders/jV >> /jVkN8QoVGXSIHfVVe53L-k+++TQ/-Tmp-//ccJ1jdEf.out >> (No such file or directory) >> make[2]: *** [xmllint] Error 1 >> make[1]: *** [all-recursive] Error 1 >> make: *** [all] Error 2 >> >> I'm not sure how to remove isysroot from CFLAGS and LDFLAGS >> as was mentioned in another post > > See buildlibxml.py. > > >> I'm trying to use a buildout to install currently. > > So the above is from a buildout? Which are you using? I got a recipe from a site online (http://pypi.python.org/pypi/z3c.recipe.staticlxml ) and modified it slightly. Strangely, just after I posted my question, I decided to try starting my buildout over in a different directory as a final attempt and it worked perfectly. I'm not sure what the difference was, but it's working fine now. Thanks for your help! Lacy From mitlox at op.pl Wed May 19 10:06:22 2010 From: mitlox at op.pl (xyz) Date: Wed, 19 May 2010 18:06:22 +1000 Subject: [lxml-dev] lxml install problem In-Reply-To: <4BF29439.2080703@behnel.de> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> <20100518230739.102f38c1@wp01> <4BF29439.2080703@behnel.de> Message-ID: <20100519180622.53abdf77@wp01> On Tue, 18 May 2010 15:20:57 +0200 Stefan Behnel wrote: > xyz, 18.05.2010 15:07: > > On Tue, 18 May 2010 14:48:47 +0200 > > Stefan Behnel wrote: > >> xyz wrote: > >>> $ python setup.py install > >>> --with-xml2-config=/home/mit/bin/libxml2/bin/xml2-config > >>> --with-xslt-config=/home/mit/bin/libxslt/bin/xslt-config > >> > >> Try passing the --auto-rpath option. Or, even better, use > >> --static-deps=true. > > > > How can I use --static-deps=true. Could give me an example please? > > $ python setup.py install --static-deps Unfortunately it did not work for me with the following commands: $python setup.py install --static-deps Building lxml version 2.2.6. Traceback (most recent call last): File "setup.py", line 119, in STATIC_CFLAGS, STATIC_BINARIES), File "/home/mit/temp/lxml-2.2.6/setupinfo.py", line 50, in ext_modules libxslt_version=OPTION_LIBXSLT_VERSION) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 170, in build_libxml2xslt libxml2_dir = unpack_tarball(download_libxml2(download_dir, libxml2_version), build_dir) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 36, in download_libxml2 version_re, filename, version=version) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 49, in download_library fns = ftp_listdir(location) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 20, in ftp_listdir server = ftplib.FTP(netloc) File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 116, in __init__ self.connect(host) File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 134, in connect self.welcome = self.getresp() File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 209, in getresp resp = self.getmultiline() File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 195, in getmultiline line = self.getline() File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 182, in getline line = self.file.readline() File "/home/mit/programs/python/lib/python2.6/socket.py", line 406, in readline data = self._sock.recv(self._rbufsize) ----------------------------- $ python setup.py install --static-deps=true Building lxml version 2.2.6. NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available. Using build configuration of libxslt 1.1.17 Building against libxml2/libxslt in the following directory: /usr/lib64 usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: option --static-deps not recognized ----------------------------- $python setup.py install --static-deps --with-xml2-config=/home/mit/bin/libxml2/bin/xml2-config --with-xslt-config=/home/mit/bin/libxslt/bin/xslt-config Building lxml version 2.2.6. Traceback (most recent call last): File "setup.py", line 119, in STATIC_CFLAGS, STATIC_BINARIES), File "/home/mit/temp/lxml-2.2.6/setupinfo.py", line 50, in ext_modules libxslt_version=OPTION_LIBXSLT_VERSION) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 170, in build_libxml2xslt libxml2_dir = unpack_tarball(download_libxml2(download_dir, libxml2_version), build_dir) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 36, in download_libxml2 version_re, filename, version=version) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 49, in download_library fns = ftp_listdir(location) File "/home/mit/temp/lxml-2.2.6/buildlibxml.py", line 20, in ftp_listdir server = ftplib.FTP(netloc) File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 116, in __init__ self.connect(host) File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 134, in connect self.welcome = self.getresp() File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 209, in getresp resp = self.getmultiline() File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 195, in getmultiline line = self.getline() File "/home/mit/programs/python/lib/python2.6/ftplib.py", line 182, in getline line = self.file.readline() File "/home/mit/programs/python/lib/python2.6/socket.py", line 406, in readline data = self._sock.recv(self._rbufsize) socket.error: [Errno 104] Connection reset by peer What did I wrong? From stefan_ml at behnel.de Wed May 19 10:35:05 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 19 May 2010 10:35:05 +0200 Subject: [lxml-dev] lxml install problem In-Reply-To: <20100519180622.53abdf77@wp01> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> <20100518230739.102f38c1@wp01> <4BF29439.2080703@behnel.de> <20100519180622.53abdf77@wp01> Message-ID: <4BF3A2B9.6090101@behnel.de> xyz, 19.05.2010 10:06: > $python setup.py install --static-deps > [...] > "/home/mit/programs/python/lib/python2.6/socket.py", line 406, in > readline data = self._sock.recv(self._rbufsize) socket.error: [Errno > 104] Connection reset by peer > > What did I wrong? The "--static-deps" option requires FTP access to the servers that serve the libxml2 distribution. Seems like you don't have that. Stefan From mitlox at op.pl Wed May 19 11:43:25 2010 From: mitlox at op.pl (xyz) Date: Wed, 19 May 2010 19:43:25 +1000 Subject: [lxml-dev] lxml install problem In-Reply-To: <4BF3A2B9.6090101@behnel.de> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> <20100518230739.102f38c1@wp01> <4BF29439.2080703@behnel.de> <20100519180622.53abdf77@wp01> <4BF3A2B9.6090101@behnel.de> Message-ID: <20100519194325.1be6ab1a@wp01> On Wed, 19 May 2010 10:35:05 +0200 Stefan Behnel wrote: > xyz, 19.05.2010 10:06: > > $python setup.py install --static-deps > > [...] > > "/home/mit/programs/python/lib/python2.6/socket.py", line 406, in > > readline data = self._sock.recv(self._rbufsize) socket.error: [Errno > > 104] Connection reset by peer > > > > What did I wrong? > > The "--static-deps" option requires FTP access to the servers that > serve the libxml2 distribution. Seems like you don't have that. > > Stefan I gave FTP access now, but the installation failed with a "bad value": $ python setup.py install --static-deps ... make[4]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt/date' make[3]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt/date' make[3]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt' make[4]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt' make[4]: Nothing to be done for `install-exec-am'. make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt' make[3]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt' make[2]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/exslt' Making install in plugins make[2]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/plugins' make[3]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/plugins' make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/plugins' make[2]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests/plugins' make[2]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests' make[3]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests' make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests' make[2]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests' make[1]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26/tests' make[1]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26' make[2]: Entering directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26' test -z "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/bin" || /bin/mkdir -p "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/bin" /usr/bin/install -c xslt-config '/home/mit/py/lxml-2.2.5/build/tmp/libxml2/bin' test -z "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib" || /bin/mkdir -p "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib" /usr/bin/install -c -m 644 xsltConf.sh '/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib' test -z "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/share/aclocal" || /bin/mkdir -p "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/share/aclocal" /usr/bin/install -c -m 644 libxslt.m4 '/home/mit/py/lxml-2.2.5/build/tmp/libxml2/share/aclocal' test -z "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/pkgconfig" || /bin/mkdir -p "/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/pkgconfig" /usr/bin/install -c -m 644 libxslt.pc libexslt.pc '/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/pkgconfig' make[2]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26' make[1]: Leaving directory `/home/mit/py/lxml-2.2.5/build/tmp/libxslt-1.1.26' NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available. Using build configuration of libxml2 2.7.7 and libxslt 1.1.26 Building against libxml2/libxslt in the following directory: /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib running install running bdist_egg running egg_info writing src/lxml.egg-info/PKG-INFO writing top-level names to src/lxml.egg-info/top_level.txt writing dependency_links to src/lxml.egg-info/dependency_links.txt reading manifest file 'src/lxml.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'src/lxml.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/lib.linux-x86_64-2.6 creating build/lib.linux-x86_64-2.6/lxml copying src/lxml/builder.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/__init__.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/ElementInclude.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/_elementpath.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/doctestcompare.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/sax.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/cssselect.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/usedoctest.py -> build/lib.linux-x86_64-2.6/lxml copying src/lxml/pyclasslookup.py -> build/lib.linux-x86_64-2.6/lxml creating build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/html5parser.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/builder.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/clean.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/__init__.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/defs.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/_html5builder.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/_setmixin.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/soupparser.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/formfill.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/_dictmixin.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/_diffcommand.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/usedoctest.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/ElementSoup.py -> build/lib.linux-x86_64-2.6/lxml/html copying src/lxml/html/diff.py -> build/lib.linux-x86_64-2.6/lxml/html running build_ext building 'lxml.etree' extension creating build/temp.linux-x86_64-2.6 creating build/temp.linux-x86_64-2.6/src creating build/temp.linux-x86_64-2.6/src/lxml gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/mit/py/lxml-2.2.5/build/tmp/libxml2/include -I/home/mit/py/lxml-2.2.5/build/tmp/libxml2/include/libxml2 -I/home/mit/py/lxml-2.2.5/build/tmp/libxml2/include/libxslt -I/home/mit/py/lxml-2.2.5/build/tmp/libxml2/include/libexslt -I/home/mit/programs/python/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w gcc -pthread -shared build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libxml2.a /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libxslt.a /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libexslt.a -L/home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib -lz -lm -o build/lib.linux-x86_64-2.6/lxml/etree.so /usr/bin/ld: /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libxml2.a(encoding.o): relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libxml2.a: could not read symbols: Bad value collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 What did I wrong? From stefan_ml at behnel.de Wed May 19 11:56:31 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 19 May 2010 11:56:31 +0200 Subject: [lxml-dev] lxml install problem In-Reply-To: <20100519194325.1be6ab1a@wp01> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> <20100518230739.102f38c1@wp01> <4BF29439.2080703@behnel.de> <20100519180622.53abdf77@wp01> <4BF3A2B9.6090101@behnel.de> <20100519194325.1be6ab1a@wp01> Message-ID: <4BF3B5CF.9010805@behnel.de> xyz, 19.05.2010 11:43: > relocation R_X86_64_32S against `a local symbol' can not be used when > making a shared object; recompile with > -fPIC /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libxml2.a: could > not read symbols: Bad value collect2: ld returned 1 exit status error: > command 'gcc' failed with exit status 1 > > What did I wrong? You didn't read the error message. Pass "-fPIC" in your CFLAGS environment variable. Stefan From mitlox at op.pl Wed May 19 12:29:03 2010 From: mitlox at op.pl (xyz) Date: Wed, 19 May 2010 20:29:03 +1000 Subject: [lxml-dev] lxml install problem In-Reply-To: <4BF3B5CF.9010805@behnel.de> References: <20100518223507.16e909dc@wp01> <4BF28CAF.2060608@behnel.de> <20100518230739.102f38c1@wp01> <4BF29439.2080703@behnel.de> <20100519180622.53abdf77@wp01> <4BF3A2B9.6090101@behnel.de> <20100519194325.1be6ab1a@wp01> <4BF3B5CF.9010805@behnel.de> Message-ID: <20100519202903.5c36021a@wp01> On Wed, 19 May 2010 11:56:31 +0200 Stefan Behnel wrote: > xyz, 19.05.2010 11:43: > > relocation R_X86_64_32S against `a local symbol' can not be used > > when making a shared object; recompile with > > -fPIC /home/mit/py/lxml-2.2.5/build/tmp/libxml2/lib/libxml2.a: could > > not read symbols: Bad value collect2: ld returned 1 exit status > > error: command 'gcc' failed with exit status 1 > > > > What did I wrong? > > You didn't read the error message. Pass "-fPIC" in your CFLAGS > environment variable. > > Stefan I have got a new problem after I compiled lxml in the following way: $ CFLAGS="-fPIC";export CFLAGS $ python setup.py install --static-deps ... copying build/lib.linux-x86_64-2.6/lxml/cssselect.py -> build/bdist.linux-x86_64/egg/lxml copying build/lib.linux-x86_64-2.6/lxml/usedoctest.py -> build/bdist.linux-x86_64/egg/lxml copying build/lib.linux-x86_64-2.6/lxml/pyclasslookup.py -> build/bdist.linux-x86_64/egg/lxml creating build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/html5parser.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/builder.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/clean.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/__init__.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/defs.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/_html5builder.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/_setmixin.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/soupparser.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/formfill.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/_dictmixin.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/_diffcommand.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/usedoctest.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/ElementSoup.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/html/diff.py -> build/bdist.linux-x86_64/egg/lxml/html copying build/lib.linux-x86_64-2.6/lxml/etree.so -> build/bdist.linux-x86_64/egg/lxml copying build/lib.linux-x86_64-2.6/lxml/objectify.so -> build/bdist.linux-x86_64/egg/lxml byte-compiling build/bdist.linux-x86_64/egg/lxml/builder.py to builder.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/__init__.py to __init__.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/ElementInclude.py to ElementInclude.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/_elementpath.py to _elementpath.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/doctestcompare.py to doctestcompare.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/sax.py to sax.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/cssselect.py to cssselect.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/usedoctest.py to usedoctest.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/pyclasslookup.py to pyclasslookup.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/html5parser.py to html5parser.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/builder.py to builder.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/clean.py to clean.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/__init__.py to __init__.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/defs.py to defs.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/_html5builder.py to _html5builder.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/_setmixin.py to _setmixin.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/soupparser.py to soupparser.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/formfill.py to formfill.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/_dictmixin.py to _dictmixin.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/_diffcommand.py to _diffcommand.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/usedoctest.py to usedoctest.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/ElementSoup.py to ElementSoup.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/html/diff.py to diff.pyc creating stub loader for lxml/etree.so creating stub loader for lxml/objectify.so byte-compiling build/bdist.linux-x86_64/egg/lxml/etree.py to etree.pyc byte-compiling build/bdist.linux-x86_64/egg/lxml/objectify.py to objectify.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying src/lxml.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying src/lxml.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying src/lxml.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying src/lxml.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO copying src/lxml.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt creating dist creating 'dist/lxml-2.2.5-py2.6-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing lxml-2.2.5-py2.6-linux-x86_64.egg creating /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.5-py2.6-linux-x86_64.egg Extracting lxml-2.2.5-py2.6-linux-x86_64.egg to /home/mit/programs/python/lib/python2.6/site-packages Removing lxml 2.2.6 from easy-install.pth file Adding lxml 2.2.5 to easy-install.pth file Installed /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.5-py2.6-linux-x86_64.egg Processing dependencies for lxml==2.2.5 Finished processing dependencies for lxml==2.2.5 ~ $ python Python 2.6.4 (r264:75706, Jan 28 2010, 14:19:59) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from lxml import etree Traceback (most recent call last): File "", line 1, in ImportError: /home/mit/programs/python/lib/python2.6/site-packages/lxml-2.2.5-py2.6-linux-x86_64.egg/lxml/etree.so: undefined symbol: gcry_check_version >>> I have libgcrypt installed $rpm -qa libgcrypt libgcrypt-1.4.4-5.el5.i386 libgcrypt-1.4.4-5.el5.x86_64 What did I wrong? From alecs.box at gmail.com Wed May 19 13:45:49 2010 From: alecs.box at gmail.com (Sosnovskiy Alexander) Date: Wed, 19 May 2010 14:45:49 +0300 Subject: [lxml-dev] How to get a header from xml file Message-ID: Library is perfect , but I have a small problem. Can someone give me an advice of how to get href = ...... - path to xsl file from the following xml-file : Thanks in advance :) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100519/f116c241/attachment-0001.htm From cfbearden at gmail.com Wed May 19 20:41:19 2010 From: cfbearden at gmail.com (Chuck Bearden) Date: Wed, 19 May 2010 13:41:19 -0500 Subject: [lxml-dev] Fwd: How to get a header from xml file In-Reply-To: References: Message-ID: Sorry, I should have replied to the list as well for future readers. ---------- Forwarded message ---------- From: Chuck Bearden Date: Wed, May 19, 2010 at 10:50 AM Subject: Re: [lxml-dev] How to get a header from xml file To: Sosnovskiy Alexander On Wed, May 19, 2010 at 6:45 AM, Sosnovskiy Alexander wrote: > Library is perfect , but I have a small problem. > Can someone give me an advice of how to get? href = ...... - path to xsl > file from the following xml-file : > > > > > > > Thanks in advance :) Here are two approaches: >>> from StringIO import StringIO >>> from lxml import etree >>> parser = etree.XMLParser(remove_pis=False) >>> xString = """ ... ... ... ... """ >>> xTree = etree.parse(StringIO(xString), parser) # The ElementTree way >>> xTree.getroot().getprevious() >>> # The XPath way >>> xTree.xpath('/processing-instruction()') [] >>> procInstruction = xTree.xpath('/processing-instruction()')[0] >>> procInstruction.text 'href="../xsl/index.xsl" type="text/xsl" ' XML and related technologies don't define an API for access to the innards of a PI, so you'll have to use text processing tools to parse the pseudo attribute/value pairs. Best wishes, Chuck From tom_schr at web.de Wed May 19 20:26:54 2010 From: tom_schr at web.de (Thomas Schraitle) Date: Wed, 19 May 2010 20:26:54 +0200 Subject: [lxml-dev] How to get a header from xml file In-Reply-To: References: Message-ID: <201005192026.54517.tom_schr@web.de> Hi, Wednesday 19 May 2010 > Library is perfect , but I have a small problem. > Can someone give me an advice of how to get href = ...... - path to xsl > file from the following xml-file : > > > > > Try this one: ------------------ tree = etree.XML(""" """) root = tree.getroottree() stylesheet = root.xpath("/processing-instruction('xml-stylesheet')")[0] print stylesheet.text ------------------ Probably there are other methods. :) Note, a processing instruction just knows a target (here: xml-stylesheet) and its content (everything in between ""). A processing instruction has no concept of attributes. As such, you can get only text which you have to parse by yourself. This can be done by a regular expression. For example: ------------------ import re m=re.search('href\s*="([a-zA-Z0-9./\-\\+%]+)"', stylesheet.text) print m.groups() ('../xsl/index.xsl',) ------------------ Depending on what you expect in the href "pseudo-attribute", you have to improve the pattern in the above regular expression. Hope that helps, Tom From stefan_ml at behnel.de Thu May 20 08:50:02 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Thu, 20 May 2010 08:50:02 +0200 Subject: [lxml-dev] How to get a header from xml file In-Reply-To: <201005192026.54517.tom_schr@web.de> References: <201005192026.54517.tom_schr@web.de> Message-ID: <4BF4DB9A.5090705@behnel.de> Thomas Schraitle, 19.05.2010 20:26: > Wednesday 19 May 2010 > >> Library is perfect , but I have a small problem. >> Can someone give me an advice of how to get href = ...... - path to xsl >> file from the following xml-file : >> >> >> >> >> > > tree = etree.XML(...) > root = tree.getroottree() I'd swap the variable names here. > stylesheet = root.xpath("/processing-instruction('xml-stylesheet')")[0] getprevious() will do just fine. > Note, a processing instruction just knows a target (here: xml-stylesheet) and > its content (everything in between ""). A processing > instruction has no concept of attributes. lxml.etree special cases the xml-stylesheet PI, though, so you can use get() and set() on it, and ask it to parse the stylesheet. http://codespeak.net/lxml/api/lxml.etree._XSLTProcessingInstruction-class.html Stefan From public at codethief.eu Fri May 21 01:35:39 2010 From: public at codethief.eu (codethief) Date: Fri, 21 May 2010 01:35:39 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) Message-ID: Hey developers :) we're already excited about using lxml in our project, though can't quite get it to work. First of all: We (me and another guy) are both running Ubuntu 10.04 x64 and Python 3. It began when easy_installing the package: -- $ sudo easy_install3 lxml Searching for lxml Reading http://pypi.python.org/simple/lxml/ Reading http://codespeak.net/lxml Best match: lxml 2.2.6 Downloading http://codespeak.net/lxml/lxml-2.2.6.tgz Processing lxml-2.2.6.tgz Running lxml-2.2.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-X0lzwT/lxml-2.2.6/egg-dist-tmp-Sv2xWe Building lxml version 2.2.6. NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available. Using build configuration of libxslt 1.1.26 Building against libxml2/libxslt in the following directory: /usr/lib ?File "build/bdist.linux-x86_64/egg/lxml/html/_diffcommand.py", line 37 ? ?print 'Error: you must give two files' ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^ SyntaxError: invalid syntax ?File "build/bdist.linux-x86_64/egg/lxml/html/_html5builder.py", line 80 ? ?root = html.fromstring(u''.join(buf)) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^ SyntaxError: invalid syntax ?File "/usr/local/lib/python3.1/dist-packages/lxml-2.2.6-py3.1-linux-x86_64.egg/lxml/html/_diffcommand.py", line 37 ? ?print 'Error: you must give two files' ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^ SyntaxError: invalid syntax ?File "/usr/local/lib/python3.1/dist-packages/lxml-2.2.6-py3.1-linux-x86_64.egg/lxml/html/_html5builder.py", line 80 ? ?root = html.fromstring(u''.join(buf)) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^ SyntaxError: invalid syntax Adding lxml 2.2.6 to easy-install.pth file Installed /usr/local/lib/python3.1/dist-packages/lxml-2.2.6-py3.1-linux-x86_64.egg Processing dependencies for lxml Finished processing dependencies for lxml -- It looks like python (v3?) is complaining about v2 features? Anyway, importing works (at least, it seems so): $ python3 >>> from lxml import etree >>> However, we can't get our code to work: -- import socketserver from lxml import etree #from xml.etree import ElementTree as etree import settings class CloudiaServer(socketserver.ThreadingMixIn, socketserver.TCPServer): pass class RequestHandler(socketserver.StreamRequestHandler): def handle(self): for event, element in etree.iterparse(self.rfile): if event != 'end': continue print(element.tag) print(str(element.attrib)) print(element.text) element.clean() if __name__ == '__main__': server = CloudiaServer((settings.host, settings.port), RequestHandler) server.serve_forever() -- As soon as our client connects and sends b'text', the server process outputs: -- Exception happened during processing of request from ('127.0.0.1', 39620) Traceback (most recent call last): File "/usr/lib/python3.1/socketserver.py", line 558, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python3.1/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python3.1/socketserver.py", line 614, in __init__ self.handle() File "/home/codethief/projekte/cloudia/server/src/server.py", line 13, in handle for event, element in etree.iterparse(self.rfile): File "iterparse.pxi", line 378, in lxml.etree.iterparse.__init__ (src/lxml/lxml.etree.c:85769) File "apihelpers.pxi", line 1503, in lxml.etree._getFilenameForFile (src/lxml/lxml.etree.c:22366) File "/usr/lib/python3.1/posixpath.py", line 363, in abspath if not isabs(path): File "/usr/lib/python3.1/posixpath.py", line 61, in isabs return s.startswith(sep) AttributeError: 'int' object has no attribute 'startswith' -- Does this maybe have something to do with essentially parsing a byte stream? -- Simon Hirscher http://simonhirscher.de From public at codethief.eu Fri May 21 01:49:17 2010 From: public at codethief.eu (codethief) Date: Fri, 21 May 2010 01:49:17 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) In-Reply-To: References: Message-ID: Excuse me, I forgot to add that replacing lxml with xml.etree, which can be seen at the beginning of the code, works like a charm. (Of course, only if you comment out the element.clean() line.) -- Simon Hirscher http://simonhirscher.de From stefan_ml at behnel.de Fri May 21 08:19:43 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Fri, 21 May 2010 08:19:43 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) In-Reply-To: References: Message-ID: <4BF625FF.8030704@behnel.de> codethief, 21.05.2010 01:35: > -- > $ sudo easy_install3 lxml > [...] > Building against libxml2/libxslt in the following directory: /usr/lib > File "build/bdist.linux-x86_64/egg/lxml/html/_diffcommand.py", line 37 > print 'Error: you must give two files' > ^ > SyntaxError: invalid syntax > > File "build/bdist.linux-x86_64/egg/lxml/html/_html5builder.py", line 80 > root = html.fromstring(u''.join(buf)) > ^ > SyntaxError: invalid syntax Hmmm, looks like these two files are not used in the test suite. Anyway, unless you really want to use them, you'll be fine with all the rest. > for event, element in etree.iterparse(self.rfile): > [...] > File "iterparse.pxi", line 378, in lxml.etree.iterparse.__init__ > (src/lxml/lxml.etree.c:85769) > File "apihelpers.pxi", line 1503, in lxml.etree._getFilenameForFile > (src/lxml/lxml.etree.c:22366) > File "/usr/lib/python3.1/posixpath.py", line 363, in abspath > if not isabs(path): > File "/usr/lib/python3.1/posixpath.py", line 61, in isabs > return s.startswith(sep) > AttributeError: 'int' object has no attribute 'startswith' That's because you are passing a byte string as path. Might be a bug in Py3, don't know. Passing a unicode string instead will help. > Does this maybe have something to do with essentially parsing a byte stream? Unless "self.rfile" *is* the byte stream - no. XML is a sequence of bytes anyway. In case you mixed up the interface and self.rfile actually contains the data instead of a filename, wrap it in a BytesIO instance. Stefan From public at codethief.eu Fri May 21 12:28:01 2010 From: public at codethief.eu (codethief) Date: Fri, 21 May 2010 12:28:01 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) Message-ID: > Hmmm, looks like these two files are not used in the test suite. > > Anyway, unless you really want to use them, you'll be fine with all the > rest. So, are those two files actually part of the test suite or do they belong to the library and just aren't tested in the test suite for Python 3? Either way, this is a bug which should be reported, isn't it? > That's because you are passing a byte string as path. Might be a bug in Py3, > don't know. Passing a unicode string instead will help. >> Does this maybe have something to do with essentially parsing a byte >> stream? > > Unless "self.rfile" *is* the byte stream - no. XML is a sequence of bytes > anyway. In case you mixed up the interface and self.rfile actually contains > the data instead of a filename, wrap it in a BytesIO instance. Path? Filename? Doesn't iterparse expect a file-like object to read() from? See http://codespeak.net/lxml/tutorial.html#event-driven-parsing. self.rfile is such a file-like object with read access to the bytes coming in through the socket (as described here: http://docs.python.org/release/3.1.1/library/socketserver.html). Anyway, xml.etree does its thing perfectly here and takes the bytes stream representing ASCII characters (as of now, will be UTF-8 later on) without complaining (but we need proper namespace support so it's not an option). As lxml promises to be 99% compatible to xml.etree, something must be wrong here. Should I file a bug report? -- Simon Hirscher http://simonhirscher.de From aronbierbaum at gmail.com Fri May 21 18:23:52 2010 From: aronbierbaum at gmail.com (Aron Bierbaum) Date: Fri, 21 May 2010 11:23:52 -0500 Subject: [lxml-dev] Using XMLSchema to validate a document with multiple namespace pairs in schemaLocation attribute Message-ID: We have been trying to use the XMLSchema validation capabilities in order to validate the result that we get from a WMS server. We are having problems because the document that we are trying to validate lists multiple schemas in the schemaLocation attribute. Is there currently a way to accomplish this with lxml/libxml2? I have attached an example of what we are attempting. lxml: 2.2.2 libxml2: 2.7.3 Thank you, Aron -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: application/octet-stream Size: 969 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100521/324d87c4/attachment-0003.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: wms_1_3_0.xml Type: text/xml Size: 21220 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100521/324d87c4/attachment-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: wms_capabilities_1_3_0.xsd Type: application/octet-stream Size: 21641 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100521/324d87c4/attachment-0004.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: xlinks_1_0_0.xsd Type: application/octet-stream Size: 5248 bytes Desc: not available Url : http://codespeak.net/pipermail/lxml-dev/attachments/20100521/324d87c4/attachment-0005.obj From stefan_ml at behnel.de Fri May 21 18:54:06 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Fri, 21 May 2010 18:54:06 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) In-Reply-To: References: Message-ID: <4BF6BAAE.8080905@behnel.de> codethief, 21.05.2010 12:28: >> Hmmm, looks like these two files are not used in the test suite. >> >> Anyway, unless you really want to use them, you'll be fine with all the >> rest. > > So, are those two files actually part of the test suite or do they > belong to the library and just aren't tested in the test suite for > Python 3? The latter. > Either way, this is a bug which should be reported, isn't it? Sure, thanks for doing that. >> That's because you are passing a byte string as path. Might be a bug in Py3, >> don't know. Passing a unicode string instead will help. > >>> Does this maybe have something to do with essentially parsing a byte >>> stream? >> >> Unless "self.rfile" *is* the byte stream - no. XML is a sequence of bytes >> anyway. In case you mixed up the interface and self.rfile actually contains >> the data instead of a filename, wrap it in a BytesIO instance. > > Path? Filename? Doesn't iterparse expect a file-like object to read() > from? Both. > self.rfile is such a file-like object with read access to the bytes > coming in through the socket (as described here: > http://docs.python.org/release/3.1.1/library/socketserver.html). Ok, so I misinterpreted the error trace. The respective code in lxml.etree needs to be somewhat flexible and ended up a bit too fragile. So, if you pass a "non-standard" file-like object, it might end up raising an exception like this. Here's a fix. Take care to use Cython 0.12.1 when you build from patched lxml 2.2.x sources. === src/lxml/apihelpers.pxi ================================================================== --- src/lxml/apihelpers.pxi (revision 5591) +++ src/lxml/apihelpers.pxi (local) @@ -1571,17 +1571,24 @@ Returns None if not a file object. """ - # file instances have a name attribute - filename = getattr(source, u'name', None) - if filename is not None: - return os_path_abspath(filename) # urllib2 provides a geturl() method - geturl = getattr(source, u'geturl', None) - if geturl is not None: - return geturl() + try: + return source.geturl() + except: + pass # gzip file instances have a filename attribute (before Py3k) - filename = getattr(source, u'filename', None) - if filename is not None: - return os_path_abspath(filename) + try: + filename = source.filename + if _isString(filename): + return os_path_abspath(filename) + except: + pass + # file instances have a name attribute + try: + filename = source.name + if _isString(filename): + return os_path_abspath(filename) + except: + pass # can't determine filename return None Stefan From l at lrowe.co.uk Sun May 23 02:42:59 2010 From: l at lrowe.co.uk (Laurence Rowe) Date: Sun, 23 May 2010 01:42:59 +0100 Subject: [lxml-dev] Building Python2.6 Windows eggs Message-ID: I've been unable to build lxml under windows using mingw, having followed the instructions from: * http://plone.org/documentation/kb/using-buildout-on-windows * http://codespeak.net/lxml/build.html#static-linking-on-windows The full error message is attached, but this seems to be the same undefined refernece problems people have run into before (e.g. http://osdir.com/ml/python.lxml.devel/2007-07/msg00039.html). Any idea what I'm doing wrong? Or do I need visual studio? It would be great if someone could build a python 2.6 Windows egg and upload it to pypi! Laurence -------------- next part -------------- C:\scratch\lxmlbuild\lxml-2.2.6>python setup.py bdist_wininst --static Building lxml version 2.2.6. NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' need s to be available. ERROR: 'xslt-config' is not recognized as an internal or external command, operable program or batch file. ** make sure the development packages of libxml2 and libxslt are installed ** Using build configuration of libxslt Building against libxml2/libxslt in one of the following directories: ..\libxml2-2.7.6.win32\lib ..\libxslt-1.1.26.win32\lib ..\zlib-1.2.3.win32\lib ..\iconv-1.9.2.win32\lib running bdist_wininst running build running build_py running build_ext building 'lxml.etree' extension C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -I..\libxml2-2.7.6.win32\include -I..\libxslt-1.1.26.win32\include -I..\zlib-1.2.3.win32\include -I..\iconv-1.9. 2.win32\include -IC:\Python26\include -IC:\Python26\PC -c src/lxml/lxml.etree.c -o build\temp.win32-2.6\Release\src\lxml\lxml.etree.o -w writing build\temp.win32-2.6\Release\src\lxml\etree.def C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.6\Release\src\lxm l\lxml.etree.o build\temp.win32-2.6\Release\src\lxml\etree.def -L..\libxml2-2.7. 6.win32\lib -L..\libxslt-1.1.26.win32\lib -L..\zlib-1.2.3.win32\lib -L..\iconv-1 .9.2.win32\lib -LC:\Python26\libs -LC:\Python26\PCbuild -llibxslt_a -llibexslt_a -llibxml2_a -liconv_a -lzlib -lWS2_32 -lpython26 -lmsvcr90 -o build\lib.win32-2 .6\lxml\etree.pyd Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"ws 2_32.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"ad vapi32.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MS VCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized Warning: .drectve `/DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized ..\libxslt-1.1.26.win32\lib/libxslt_a.lib(int.xslta.msvc/xsltutils.obj):..\libxs lt\xsltuti:(.text[_xsltTimestamp]+0xa5): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libxslt_a.lib(int.xslta.msvc/numbers.obj):..\libxslt \numbers:(.text[_xsltNumberFormatDecimal]+0x9c): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libxslt_a.lib(int.xslta.msvc/numbers.obj):..\libxslt \numbers:(.text[_xsltNumberFormatAlpha]+0x4b): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libxslt_a.lib(int.xslta.msvc/numbers.obj):..\libxslt \numbers:(.text[_xsltNumberFormat]+0x6): undefined reference to `_chkstk' ..\libxslt-1.1.26.win32\lib/libexslt_a.lib(int.exslta.msvc/date.obj):..\libexslt \date.c:(.text[_exsltDateParseDuration]+0x226): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libexslt_a.lib(int.exslta.msvc/date.obj):..\libexslt \date.c:(.text[_exsltDateParseDuration]+0x230): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libexslt_a.lib(int.exslta.msvc/date.obj):..\libexslt \date.c:(.text[_exsltDateFormatDuration]+0x119): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libexslt_a.lib(int.exslta.msvc/date.obj):..\libexslt \date.c:(.text[_exsltDateFormatDuration]+0x175): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libexslt_a.lib(int.exslta.msvc/date.obj):..\libexslt \date.c:(.text[_exsltDateFormatDuration]+0x213): undefined reference to `_ftol2' ..\libxslt-1.1.26.win32\lib/libexslt_a.lib(int.exslta.msvc/date.obj):..\libexslt \date.c:(.text[_exsltDateFormatDuration]+0x28a): more undefined references to `_ ftol2' follow ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/valid.obj):..\valid.c:(.text [_xmlValidBuildContentModel]+0x6): undefined reference to `_chkstk' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/valid.obj):..\valid.c:(.text [_xmlValidateElementContent]+0x6): undefined reference to `_chkstk' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/encoding.obj):..\encoding.c: (.text[_xmlByteConsumed]+0x6): undefined reference to `_chkstk' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xpointer.obj):..\xpointer.c: (.text[_xmlXPtrStringRangeFunction]+0x65): undefined reference to `_ftol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xpointer.obj):..\xpointer.c: (.text[_xmlXPtrStringRangeFunction]+0x9d): undefined reference to `_ftol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/debugXML.obj):..\debugXML.c: (.text[_xmlCtxtDumpElemDecl]+0x6): undefined reference to `_chkstk' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xmlschemastypes.obj):..\xmls chemastypes:(.text[_xmlSchemaValidateDuration]+0x21c): undefined reference to `_ ftol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xmlschemastypes.obj):..\xmls chemastypes:(.text[_xmlSchemaValidateDuration]+0x226): undefined reference to `_ ftol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xmlschemastypes.obj):..\xmls chemastypes:(.text[_xmlSchemaCompareDurations]+0x2f): undefined reference to `_f tol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xmlschemastypes.obj):..\xmls chemastypes:(.text[__xmlSchemaDateAdd]+0xfe): undefined reference to `_ftol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xmlschemastypes.obj):..\xmls chemastypes:(.text[__xmlSchemaDateAdd]+0x120): undefined reference to `_ftol2' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/xmlschemastypes.obj):..\xmls chemastypes:(.text[__xmlSchemaDateAdd]+0x171): more undefined references to `_ft ol2' follow ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/nanohttp.obj):..\nanohttp.c: (.text[_xmlNanoHTTPReadLine]+0x6): undefined reference to `_chkstk' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/nanoftp.obj):..\nanoftp.c:(. text[_xmlNanoFTPList]+0x6): undefined reference to `_chkstk' ..\libxml2-2.7.6.win32\lib/libxml2_a.lib(int.a.msvc/nanoftp.obj):..\nanoftp.c:(. text[_xmlNanoFTPGet]+0x6): undefined reference to `_chkstk' ..\iconv-1.9.2.win32\lib/iconv_a.lib(iconv.obj):./iconv.c:(.text[_libiconvlist]+ 0x9): undefined reference to `_chkstk' ..\zlib-1.2.3.win32\lib/zlib.lib(gzio.obj):gzio.c:(.text[_gzprintf]+0x6): undefi ned reference to `_chkstk' collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 C:\scratch\lxmlbuild\lxml-2.2.6> From c-dilla at gmx.ch Sun May 23 12:14:15 2010 From: c-dilla at gmx.ch (Michael Konietzny) Date: Sun, 23 May 2010 12:14:15 +0200 Subject: [lxml-dev] Building Python2.6 Windows eggs In-Reply-To: References: Message-ID: <4BF8FFF7.2040500@gmx.ch> Hey Laurence, there is one in version 2.2.4. I was also searching my ass of and then accidentally clicked on version 2.2.4 :-). http://pypi.python.org/pypi/lxml/2.2.4 Greetings, Michael Am 23.05.2010 02:42, schrieb Laurence Rowe: > I've been unable to build lxml under windows using mingw, having > followed the instructions from: > > * http://plone.org/documentation/kb/using-buildout-on-windows > * http://codespeak.net/lxml/build.html#static-linking-on-windows > > The full error message is attached, but this seems to be the same > undefined refernece problems people have run into before (e.g. > http://osdir.com/ml/python.lxml.devel/2007-07/msg00039.html). > > Any idea what I'm doing wrong? Or do I need visual studio? > > It would be great if someone could build a python 2.6 Windows egg and > upload it to pypi! > > Laurence > > > > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100523/61dee2b3/attachment.htm From relativityguy at gmail.com Sun May 23 19:07:04 2010 From: relativityguy at gmail.com (Lashkara Singh) Date: Sun, 23 May 2010 22:37:04 +0530 Subject: [lxml-dev] Confused as to use a class or a function: Writing XML files using lxml and Python Message-ID: Hi. I need to write XML files using lxml and Python. However, I can't figure out whether to use a class to do this or a function. The point being, this is the first time I am developing a proper software and deciding where and why to use a class still seems mysterious. I will illustrate my point. For example, consider the following function based code I wrote for adding a subelement to a etree root. from lxml import etree > > root = etree.Element('document') > > def createSubElement(text, tagText = ""): > etree.SubElement(root, text) > # How do I do this: element.text = tagText > > createSubElement('firstChild') > createSubElement('SecondChild') > As expected, the output of this is: > > > > However as you can notice the comment, I have no idea how to do set the text variable using this approach. Is using a class the only way to solve this? And if yes, can you give me some pointers on how to achieve this? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100523/ab07d9e1/attachment.htm From stefan_ml at behnel.de Mon May 24 12:28:11 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Mon, 24 May 2010 12:28:11 +0200 Subject: [lxml-dev] Confused as to use a class or a function: Writing XML files using lxml and Python In-Reply-To: References: Message-ID: <4BFA54BB.9030701@behnel.de> Lashkara Singh, 23.05.2010 19:07: > I need to write XML files using lxml and Python. > > However, I can't figure out whether to use a class to do this or a function. > The point being, this is the first time I am developing a proper software > and deciding where and why to use a class still seems mysterious. I'm not sure what you mean by "class or function", but you likely want to read the lxml tutorial as well as the ElementTree tutorial. Both are linked from the home page. Stefan From l at lrowe.co.uk Tue May 25 14:02:57 2010 From: l at lrowe.co.uk (Laurence Rowe) Date: Tue, 25 May 2010 13:02:57 +0100 Subject: [lxml-dev] Failure to open http urls on Windows Message-ID: Hi, I'm seeing an IOError when resolving http urls on Windows (it works fine on Mac OS X): >>> from lxml import etree >>> etree.parse('http://codespeak.net/', parser=etree.HTMLParser()) Traceback (most recent call last): File "", line 1, in ? File "lxml.etree.pyx", line 2706, in lxml.etree.parse (src/lxml/lxml.etree.c:49958) File "parser.pxi", line 1500, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71797) File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:72080) File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:71175) File "parser.pxi", line 975, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:68173) File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:64257) File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:65178) File "parser.pxi", line 563, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64493) IOError: Error reading file 'http://codespeak.net/': failed to load external entity "http://codespeak.net/" From steven.vereecken at gmail.com Tue May 25 14:27:44 2010 From: steven.vereecken at gmail.com (Steven Vereecken) Date: Tue, 25 May 2010 14:27:44 +0200 Subject: [lxml-dev] Failure to open http urls on Windows In-Reply-To: References: Message-ID: I've encountered the same problem. As far as I can tell, the problem lies with the libxml2 version that is used. This bug apparently is fixed in the libxml2 2.7.7 (from the release notes: "598785 Fix nanohttp on Windows"), but there are no windows binaries available for that version yet. Apparently the bug was introduced in libxml2 2.7.4 (with "59501 avoid select and use poll for nanohttp"?) The compiled windows versions of lxml seem to be affected from lxml 2.3 and up. I've tried building later versions of lxml with older libxml2 (using the instructions from the lxml website), and this seems to work. So I'm pretty confident that I'm right about the cause of the problem. I wouldn't know how to compile libxml2 itself though. Hope this helps, or at least clarifies the issue. greetings, Steven 2010/5/25 Laurence Rowe : > Hi, > > I'm seeing an IOError when resolving http urls on Windows (it works > fine on Mac OS X): > >>>> from lxml import etree >>>> etree.parse('http://codespeak.net/', parser=etree.HTMLParser()) > Traceback (most recent call last): > ?File "", line 1, in ? > ?File "lxml.etree.pyx", line 2706, in lxml.etree.parse > (src/lxml/lxml.etree.c:49958) > ?File "parser.pxi", line 1500, in lxml.etree._parseDocument > (src/lxml/lxml.etree.c:71797) > ?File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL > (src/lxml/lxml.etree.c:72080) > ?File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile > (src/lxml/lxml.etree.c:71175) > ?File "parser.pxi", line 975, in > lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:68173) > ?File "parser.pxi", line 539, in > lxml.etree._ParserContext._handleParseResultDoc > (src/lxml/lxml.etree.c:64257) > ?File "parser.pxi", line 625, in lxml.etree._handleParseResult > (src/lxml/lxml.etree.c:65178) > ?File "parser.pxi", line 563, in lxml.etree._raiseParseError > (src/lxml/lxml.etree.c:64493) > IOError: Error reading file 'http://codespeak.net/': failed to load > external entity "http://codespeak.net/" > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev > From l at lrowe.co.uk Tue May 25 15:47:09 2010 From: l at lrowe.co.uk (Laurence Rowe) Date: Tue, 25 May 2010 14:47:09 +0100 Subject: [lxml-dev] Failure to open http urls on Windows In-Reply-To: References: Message-ID: Thanks Steven. Which compiler do you use for building lxml on Windows? (I didn't have any luck with MinGW.) Laurence On 25 May 2010 13:27, Steven Vereecken wrote: > I've encountered the same problem. As far as I can tell, the problem > lies with the libxml2 version that is used. This bug apparently is > fixed in the libxml2 2.7.7 (from the release notes: "598785 Fix > nanohttp on Windows"), but there are no windows binaries available for > that version yet. > Apparently the bug was introduced in libxml2 2.7.4 (with "59501 avoid > select and use poll for nanohttp"?) > > The compiled windows versions of lxml seem to be affected from lxml > 2.3 and up. I've tried building later versions of lxml with older > libxml2 (using the instructions from the lxml website), and this seems > to work. So I'm pretty confident that I'm right about the cause of the > problem. I wouldn't know how to compile libxml2 itself though. > > Hope this helps, or at least clarifies the issue. > > greetings, > > Steven > > > 2010/5/25 Laurence Rowe : >> Hi, >> >> I'm seeing an IOError when resolving http urls on Windows (it works >> fine on Mac OS X): >> >>>>> from lxml import etree >>>>> etree.parse('http://codespeak.net/', parser=etree.HTMLParser()) >> Traceback (most recent call last): >> ?File "", line 1, in ? >> ?File "lxml.etree.pyx", line 2706, in lxml.etree.parse >> (src/lxml/lxml.etree.c:49958) >> ?File "parser.pxi", line 1500, in lxml.etree._parseDocument >> (src/lxml/lxml.etree.c:71797) >> ?File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL >> (src/lxml/lxml.etree.c:72080) >> ?File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile >> (src/lxml/lxml.etree.c:71175) >> ?File "parser.pxi", line 975, in >> lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:68173) >> ?File "parser.pxi", line 539, in >> lxml.etree._ParserContext._handleParseResultDoc >> (src/lxml/lxml.etree.c:64257) >> ?File "parser.pxi", line 625, in lxml.etree._handleParseResult >> (src/lxml/lxml.etree.c:65178) >> ?File "parser.pxi", line 563, in lxml.etree._raiseParseError >> (src/lxml/lxml.etree.c:64493) >> IOError: Error reading file 'http://codespeak.net/': failed to load >> external entity "http://codespeak.net/" >> _______________________________________________ >> lxml-dev mailing list >> lxml-dev at codespeak.net >> http://codespeak.net/mailman/listinfo/lxml-dev >> > From alex.bernier at free.fr Tue May 25 18:46:15 2010 From: alex.bernier at free.fr (Alex Bernier) Date: Tue, 25 May 2010 18:46:15 +0200 Subject: [lxml-dev] Accessing text of an element when using itemparse Message-ID: <20100525164615.GA3900@Pinson> Hello, When using itemparse, during 'start' event, is the text of an element accessible ? Or text can only be accessed during 'end' event ? from sys import stdout from lxml.etree import iterparse if __name__ == '__main__': context = iterparse("in.xml",events=('start','end')) for event, element in context: if event=='start' and (type(element.text) is unicode or type(element.text) is str): stdout.write(element.text.encode('utf-8')) I get different results with this code and the same one replacing "if event=='start'" by "if event=='end'" : is it normal ? Best regards, Alex Bernier From stefan_ml at behnel.de Tue May 25 19:14:37 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 25 May 2010 19:14:37 +0200 Subject: [lxml-dev] Accessing text of an element when using itemparse In-Reply-To: <20100525164615.GA3900@Pinson> References: <20100525164615.GA3900@Pinson> Message-ID: <4BFC057D.7020400@behnel.de> Alex Bernier, 25.05.2010 18:46: > When using itemparse, during 'start' event, is the text of an element accessible ? No. Any content may or may not be available at this point, there is no guarantee. > Or text can only be accessed during 'end' event ? Yes. Stefan From Russell.S.Johnson at gmail.com Tue May 25 19:41:04 2010 From: Russell.S.Johnson at gmail.com (Russ Johnson) Date: Tue, 25 May 2010 13:41:04 -0400 Subject: [lxml-dev] Unable to build lxml Message-ID: I'm attempting to built lxml 2.2.6 for Python 2.7b2 on Windows XP using static linking, but the build fails with the following error: > python setup.py install --static Building lxml version 2.2.6. NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' need s to be available. ERROR: 'xslt-config' is not recognized as an internal or external command, operable program or batch file. ** make sure the development packages of libxml2 and libxslt are installed ** Using build configuration of libxslt Building against libxml2/libxslt in one of the following directories: ..\iconv-1.9.2.win32\lib ..\libxml2-2.7.6.win32\lib ..\libxslt-1.1.26.win32\lib ..\zlib-1.2.3.win32\lib running build running build_py running build_ext building 'lxml.etree' extension error: Unable to find vcvarsall.bat I gathered from http://codespeak.net/lxml/build.html#static-linking-on-windows that I need development packages, but I'm at a loss where to find them. Any suggestions? Russ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://codespeak.net/pipermail/lxml-dev/attachments/20100525/d62e3bda/attachment.htm From public at codethief.eu Tue May 25 22:57:00 2010 From: public at codethief.eu (codethief) Date: Tue, 25 May 2010 22:57:00 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) In-Reply-To: References: <4BF6BAAE.8080905@behnel.de> Message-ID: > Ok, so I misinterpreted the error trace. The respective code in lxml.etree > needs to be somewhat flexible and ended up a bit too fragile. So, if you > pass a "non-standard" file-like object, it might end up raising an exception > like this. > > Here's a fix. Take care to use Cython 0.12.1 when you build from patched > lxml 2.2.x sources. Thanks for the fix! I'm apparently too dumb to apply the .diff using patch (there was always some strange error occuring), so I patched apihelpers.pxi manually. :D When building the patched 2.2.6 sources, which I downloaded from http://pypi.python.org/packages/source/l/lxml/lxml-2.2.6.tar.gz), using Cython 0.12.1 I receive the following error: ---- $ python3 setup.py bdist_egg [...] gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/usr/include/python3.1 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-3.1/src/lxml/lxml.etree.o -w gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-3.1/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-3.1/lxml/etree.so building 'lxml.objectify' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/libxml2 -I/usr/include/python3.1 -c src/lxml/lxml.objectify.c -o build/temp.linux-x86_64-3.1/src/lxml/lxml.objectify.o -w src/lxml/lxml.objectify.c:573: error: conflicting types for ?__Pyx_ImportType? src/lxml/lxml.etree_api.h:160: note: previous definition of ?__Pyx_ImportType? was here error: command 'gcc' failed with exit status 1 ---- I tried the same with the newest SVN sources (lxml 2.3 r74722) and it worked (both, building and the bugfix). For anyone who cares I uploaded the egg: It's available on http://codethief.eu/kram/_/lxml-2.3dev-py3.1-linux-x86_64.egg P.S. Any plans to migrate to a distributed revision control system like Git or preferably (in my opinion) Mercurial? That'd make many things a lot easier. Just take github.com and bitbucket.org which expose a much nicer user interface than SVN does. :) -- Simon Hirscher http://simonhirscher.de From jkrukoff at ltgc.com Wed May 26 01:01:20 2010 From: jkrukoff at ltgc.com (John Krukoff) Date: Tue, 25 May 2010 17:01:20 -0600 Subject: [lxml-dev] Failure to open http urls on Windows In-Reply-To: References: Message-ID: <1274828480.3778.4.camel@localhost.localdomain> This is only peripherally related, but XInclude hasn't worked for me (as in dumps core) with lxml since upgrading to libxml2 2.7.4. If the windows binaries get rebuilt, might be two good reasons to link against 2.7.3. Haven't filed a bug report yet, as it's not a critical part of my system so I haven't yet been able to free up time to come up with a good test case. On Tue, 2010-05-25 at 14:27 +0200, Steven Vereecken wrote: > I've encountered the same problem. As far as I can tell, the problem > lies with the libxml2 version that is used. This bug apparently is > fixed in the libxml2 2.7.7 (from the release notes: "598785 Fix > nanohttp on Windows"), but there are no windows binaries available for > that version yet. > Apparently the bug was introduced in libxml2 2.7.4 (with "59501 avoid > select and use poll for nanohttp"?) > > The compiled windows versions of lxml seem to be affected from lxml > 2.3 and up. I've tried building later versions of lxml with older > libxml2 (using the instructions from the lxml website), and this seems > to work. So I'm pretty confident that I'm right about the cause of the > problem. I wouldn't know how to compile libxml2 itself though. > > Hope this helps, or at least clarifies the issue. > > greetings, > > Steven > > > 2010/5/25 Laurence Rowe : > > Hi, > > > > I'm seeing an IOError when resolving http urls on Windows (it works > > fine on Mac OS X): > > > >>>> from lxml import etree > >>>> etree.parse('http://codespeak.net/', parser=etree.HTMLParser()) > > Traceback (most recent call last): > > File "", line 1, in ? > > File "lxml.etree.pyx", line 2706, in lxml.etree.parse > > (src/lxml/lxml.etree.c:49958) > > File "parser.pxi", line 1500, in lxml.etree._parseDocument > > (src/lxml/lxml.etree.c:71797) > > File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL > > (src/lxml/lxml.etree.c:72080) > > File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile > > (src/lxml/lxml.etree.c:71175) > > File "parser.pxi", line 975, in > > lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:68173) > > File "parser.pxi", line 539, in > > lxml.etree._ParserContext._handleParseResultDoc > > (src/lxml/lxml.etree.c:64257) > > File "parser.pxi", line 625, in lxml.etree._handleParseResult > > (src/lxml/lxml.etree.c:65178) > > File "parser.pxi", line 563, in lxml.etree._raiseParseError > > (src/lxml/lxml.etree.c:64493) > > IOError: Error reading file 'http://codespeak.net/': failed to load > > external entity "http://codespeak.net/" > > _______________________________________________ > > lxml-dev mailing list > > lxml-dev at codespeak.net > > http://codespeak.net/mailman/listinfo/lxml-dev > > > _______________________________________________ > lxml-dev mailing list > lxml-dev at codespeak.net > http://codespeak.net/mailman/listinfo/lxml-dev -- John Krukoff Land Title Guarantee Company From stefan_ml at behnel.de Wed May 26 08:27:47 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 26 May 2010 08:27:47 +0200 Subject: [lxml-dev] Failure to open http urls on Windows In-Reply-To: <1274828480.3778.4.camel@localhost.localdomain> References: <1274828480.3778.4.camel@localhost.localdomain> Message-ID: <4BFCBF63.6000705@behnel.de> John Krukoff, 26.05.2010 01:01: > This is only peripherally related, but XInclude hasn't worked for me (as > in dumps core) with lxml since upgrading to libxml2 2.7.4. If the > windows binaries get rebuilt, might be two good reasons to link against > 2.7.3. The next binaries will hopefully use libxml2 2.7.7. No idea if this is fixed there, though. Stefan From stefan_ml at behnel.de Wed May 26 08:31:21 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 26 May 2010 08:31:21 +0200 Subject: [lxml-dev] Can't get lxml to work with Python 3 (installation with errors, importing works, usage doesn't) In-Reply-To: References: <4BF6BAAE.8080905@behnel.de> Message-ID: <4BFCC039.6050702@behnel.de> codethief, 25.05.2010 22:57: > P.S. Any plans to migrate to a distributed revision control system > like Git or preferably (in my opinion) Mercurial? No such planning, no. I actually got used to using svk for lxml. Works ok in most cases, lacks a bit of ease compared to Mercurial, but keeps the current repo as is. Stefan From jkrukoff at ltgc.com Wed May 26 22:39:53 2010 From: jkrukoff at ltgc.com (John Krukoff) Date: Wed, 26 May 2010 14:39:53 -0600 Subject: [lxml-dev] Failure to open http urls on Windows In-Reply-To: <4BFCBF63.6000705@behnel.de> References: <1274828480.3778.4.camel@localhost.localdomain> <4BFCBF63.6000705@behnel.de> Message-ID: <1274906393.3778.11.camel@localhost.localdomain> On Wed, 2010-05-26 at 08:27 +0200, Stefan Behnel wrote: > John Krukoff, 26.05.2010 01:01: > > This is only peripherally related, but XInclude hasn't worked for me (as > > in dumps core) with lxml since upgrading to libxml2 2.7.4. If the > > windows binaries get rebuilt, might be two good reasons to link against > > 2.7.3. > > The next binaries will hopefully use libxml2 2.7.7. No idea if this is > fixed there, though. > > Stefan I've been able to test against 2.7.4, 2.7.6 and 2.7.7, and XInclude is broken on all of them for me. Same code worked on 2.7.3 (and same version of lxml across 2.7.3 to 2.7.4 upgrade), so I'm pretty sure that's the magic version. I suspect the changes made for this bug fix, since it's effecting the right part of the code, and the timing is right: https://bugzilla.gnome.org/show_bug.cgi?id=584220 But like I said, mostly I need to come up with a simple test case so I can report it to the libxml2 folks. -- John Krukoff Land Title Guarantee Company From basti at redtoad.de Mon May 31 14:51:02 2010 From: basti at redtoad.de (Sebastian Rahlf) Date: Mon, 31 May 2010 14:51:02 +0200 Subject: [lxml-dev] Force element content to be string Message-ID: <20100531145102.51434veknbsgx3n4@webmail.ssl-gateway.de> Hi all! I have a bit of XML which I want to parse via lxml.objectify. from lxml import objectify node = objectify.fromstring(''' 0747532745 Joanne K. Rowling Bloomsbury Publishing Book Harry Potter and the Philosopher's Stone ''') I have the following problem: node.ASIN is evaluated to integer value 747532745 but should be a string ('0747532745'). There is no way for me to influence the incoming XML, so any py:pytype magic or adding a schema is out of the question. Is there a way to ensure that ASIN elements are always evaluated to a string? Cheers, Seb. -- Sebastian Rahlf basti at redtoad.de From stefan_ml at behnel.de Mon May 31 15:12:54 2010 From: stefan_ml at behnel.de (Stefan Behnel) Date: Mon, 31 May 2010 15:12:54 +0200 Subject: [lxml-dev] Force element content to be string In-Reply-To: <20100531145102.51434veknbsgx3n4@webmail.ssl-gateway.de> References: <20100531145102.51434veknbsgx3n4@webmail.ssl-gateway.de> Message-ID: <4C03B5D6.10203@behnel.de> Sebastian Rahlf, 31.05.2010 14:51: > I have a bit of XML which I want to parse via lxml.objectify. > > from lxml import objectify > node = objectify.fromstring(''' > > 0747532745 > > Joanne K. Rowling > Bloomsbury Publishing > Book > Harry Potter and the Philosopher's Stone > > > ''') > > I have the following problem: node.ASIN is evaluated to integer value > 747532745 but should be a string ('0747532745'). > > There is no way for me to influence the incoming XML, so any py:pytype > magic or adding a schema is out of the question. Is there a way to > ensure that ASIN elements are always evaluated to a string? Just add the type attribute after parsing and remove it before serialisation. Alternatively, you can register your own Element type for the ASIN tag. There should be something about that in the objectify docs. Stefan From basti at redtoad.de Mon May 31 17:36:39 2010 From: basti at redtoad.de (Sebastian Rahlf) Date: Mon, 31 May 2010 17:36:39 +0200 Subject: [lxml-dev] Force element content to be string In-Reply-To: <4C03B5D6.10203@behnel.de> References: <20100531145102.51434veknbsgx3n4@webmail.ssl-gateway.de> <4C03B5D6.10203@behnel.de> Message-ID: <20100531173639.44972c1fzxilwps0@webmail.ssl-gateway.de> >> I have a bit of XML which I want to parse via lxml.objectify. >> >> from lxml import objectify >> node = objectify.fromstring(''' >> >> 0747532745 >> >> Joanne K. Rowling >> Bloomsbury Publishing >> Book >> Harry Potter and the Philosopher's Stone >> >> >> ''') >> >> I have the following problem: node.ASIN is evaluated to integer value >> 747532745 but should be a string ('0747532745'). >> >> There is no way for me to influence the incoming XML, so any py:pytype >> magic or adding a schema is out of the question. Is there a way to >> ensure that ASIN elements are always evaluated to a string? > > Just add the type attribute after parsing and remove it before serialisation. > > Alternatively, you can register your own Element type for the ASIN > tag. There should be something about that in the objectify docs. > > Stefan Thanks for the tip. I wrote my own class lookup from lxml import etree class MyLookup(etree.CustomElementClassLookup): def lookup(self, node_type, document, namespace, name): if name == 'ASIN': return objectify.StringElement lookup = MyLookup() parser = etree.XMLParser() parser.set_element_class_lookup(lookup) node = objectify.fromstring(xml, parser) which now returns the right element type. node = objectify.fromstring(xml, parser) objectify.annotate(node) print objectify.dump(node) Item = None [_Element] * py:pytype = 'str' ASIN = '0747532745' [StringElement] * py:pytype = 'int' DetailPageURL = 'http://www.amazon.de/Harry-...' [_Element] * py:pytype = 'str' ItemAttributes = None [_Element] * py:pytype = 'str' Author = 'Joanne K. Rowling' [_Element] * py:pytype = 'str' Manufacturer = 'Bloomsbury Publishing' [_Element] * py:pytype = 'str' ProductGroup = 'Book' [_Element] * py:pytype = 'str' Title = "Harry Potter and the Philosopher's Stone" [_Element] * py:pytype = 'str' How do I make it fall back to objectify.ObjectifyElementClassLookup? Seb.