From Holger.Joukl at LBBW.de Tue Jan 2 14:56:05 2007 From: Holger.Joukl at LBBW.de (Holger Joukl) Date: Tue, 2 Jan 2007 14:56:05 +0100 Subject: [lxml-dev] [objectify] __MATCH_PATH_SEGMENT regex modificationsuggestion In-Reply-To: Message-ID: "Holger Joukl" schrieb am 29.12.2006 16:16:12: > I suggest to loosen the __MATCH_PATH_SEGMENT regex a little > [...] > > cdef object __MATCH_PATH_SEGMENT > __MATCH_PATH_SEGMENT = re.compile( > r"(\.?)\s*(?:\{([^}]*)\})?\s*([^.{}]+)\s*(?:\[\s*([-0-9]+)\s*\])?", > re.U).match > > (Changed: ([^.{}]+) replaces (\w+)) Sorry that was too loose as it destroys the correct matching of the index part; it should read __MATCH_PATH_SEGMENT = re.compile( r"(\.?)\s*(?:\{([^}]*)\})?\s*([^.{}\[\]]+)\s*(?:\[\s*([-0-9]+)\s*\])?", re.U).match (Changed: (([^.{}\[\]]+) replaces (\w+)) Holger Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene Empf?nger sind oder falls diese E-Mail irrt?mlich an Sie adressiert wurde, verst?ndigen Sie bitte den Absender sofort und l?schen Sie die E-Mail sodann. Das unerlaubte Kopieren sowie die unbefugte ?bermittlung sind nicht gestattet. Die Sicherheit von ?bermittlungen per E-Mail kann nicht garantiert werden. Falls Sie eine Best?tigung w?nschen, fordern Sie bitte den Inhalt der E-Mail als Hardcopy an. The contents of this e-mail are confidential. If you are not the named addressee or if this transmission has been addressed to you in error, please notify the sender immediately and then delete this e-mail. Any unauthorized copying and transmission is forbidden. E-Mail transmission cannot be guaranteed to be secure. If verification is required, please request a hard copy version. From jean.jordaan at gmail.com Wed Jan 3 10:59:49 2007 From: jean.jordaan at gmail.com (Jean Jordaan) Date: Wed, 3 Jan 2007 11:59:49 +0200 Subject: [lxml-dev] How do I get the encoding of an XML document from libxml2? Message-ID: <91d4ce220701030159x1ccb6c9w21f3313b1bc5eab3@mail.gmail.com> Hi there This request actually concerns *avoiding* depending on lxml, so apologies for that :-] I'd like to find the encoding of an XML document, as detected by libxml2, using the Python bindings. From lxml, I can get it like this: >>> et >>> et.docinfo.encoding 'windows-1252' According to the lxml API docs, lxml gets this information from libxml2 (see http://codespeak.net/lxml/api.html#parsers ) How do I get at it without depending on lxml? The only way I've been able to find is using debugDumpDocumentHead, which just prints to stdout. >>> dh = xml.debugDumpDocumentHead(xml) DOCUMENT version=1.0 encoding=windows-1252 standalone=true Regards, -- jean . .. .... //\\\oo///\\ From chrisa at matrixscience.com Wed Jan 3 18:26:26 2007 From: chrisa at matrixscience.com (Chris Allen) Date: Wed, 03 Jan 2007 17:26:26 +0000 Subject: [lxml-dev] Build on AIX5 Message-ID: Hi guys, Managed to build lxml 1.1.2 on AIX5.2, however I had to make a minor patch to "setup.py" (at the bottom of this post for anyone interested). But when I tried to run the test suite it fails as shown below. The "Installing lxml" page on the website says that Python 2.3 is supported but "DocFileSuite" seems to have arrived in 2.4. Does that mean 2.3 isn't really supported for use with lxml? -bash-2.05b$ gmake test_inplace python setup.py build_ext -i Building lxml version 1.1.2 running build_ext python test.py -p -v TESTED VERSION: Python: (2, 3, 4, 'final', 0) lxml.etree: (1, 1, 2, 0) libxml used: (2, 6, 23) libxml compiled: (2, 6, 23) libxslt used: (1, 1, 15) libxslt compiled: (1, 1, 15) Traceback (most recent call last): File "test.py", line 591, in ? exitcode = main(sys.argv) File "test.py", line 554, in main test_cases = get_test_cases(test_files, cfg, tracer=tracer) File "test.py", line 258, in get_test_cases test_suite = module.test_suite() File "/home/matrix/lxml-1.1.2/src/lxml/tests/test_etree.py", line 1262, in test_suite suite.addTests( AttributeError: 'module' object has no attribute 'DocFileSuite' gmake: *** [test_inplace] Error 1 Thanks, Chris *** setup.py.orig Sun Oct 29 18:28:34 2006 --- setup.py Wed Jan 3 16:56:59 2007 *************** *** 124,129 **** --- 124,133 ---- xslt_libs.insert(i, libname.replace('xslt', 'exslt')) break + # Sometimes (eg. AIX) "libxml2" is missing from the link list. + if not xslt_libs.count('-lxml2'): + xslt_libs.extend(flags('xml2-config --libs')) + if '--rpath' in sys.argv: # compile with --rpath under gcc sys.argv.remove('--rpath') From chrisa at matrixscience.com Wed Jan 3 19:47:35 2007 From: chrisa at matrixscience.com (Chris Allen) Date: Wed, 03 Jan 2007 18:47:35 +0000 Subject: [lxml-dev] Build on AIX5 In-Reply-To: References: Message-ID: Chris Allen wrote: > But when I tried to run the test suite it fails as shown below. The > "Installing lxml" page on the website says that Python 2.3 is supported > but "DocFileSuite" seems to have arrived in 2.4. Does that mean 2.3 > isn't really supported for use with lxml? Sorry, should have looked back at the archive first, just noticed the thread "lxml 1.1 problems with python 2.3" back in November about segfaults and I can't open a basic file unfortunately: -bash-2.05b$ PYTHONPATH=lxml-1.1.2/src ./test_lxml_basic.py pthread_mutex_lock[3]: Error 0 Segmentation fault (core dumped) -bash-2.05b$ cat test_lxml_basic.py #!/usr/bin/python from lxml import etree from StringIO import StringIO f = open('lxml-1.1.2/src/lxml/tests/test.xml', 'r') tree = etree.parse(f) f.close() -bash-2.05b$ dbx /usr/bin/python core (dbx) where PyThread_release_lock() at 0xd2aad298 PyEval_ReleaseThread() at 0xd2a732c8 PyGILState_Release() at 0xd2aac3fc __pyx_f_5etree_18_FileParserContext_copyToBuffer() at 0xd2c2b234 __pyx_f_5etree__readFilelikeParser() at 0xd2c58f48 xmlParserInputBufferGrow(0x2000b908, 0xfa0) at 0xd2cc201c xmlParserInputGrow(0x20177eb8, 0xfa) at 0xd2d1a580 xmlGROW(0x20177c38) at 0xd2ceb224 xmlParseDocument(0x20177c38) at 0xd2d03594 xmlDoRead(0x20177c38, 0x20185e2c, 0x0, 0x4002, 0x1) at 0xd2ce026c xmlCtxtReadIO(0x20177c38, 0x200d3720, 0x0, 0x20177e88, 0x20185e2c, 0x0, 0x4002) at 0xd2cfee44 __pyx_f_5etree_18_FileParserContext__readDoc() at 0xd2c2b308 __pyx_f_5etree_11_BaseParser__parseDocFromFilelike() at 0xd2c287a4 __pyx_f_5etree__parseDocFromFilelike() at 0xd2c5734c __pyx_f_5etree__parseFilelikeDocument() at 0xd2c563d8 __pyx_f_5etree__parseDocument() at 0xd2c56d90 __pyx_f_5etree_parse() at 0xd2c39128 PyCFunction_Call() at 0xd2ab1e70 call_function() at 0xd2a6ed08 eval_frame() at 0xd2a71e84 PyEval_EvalCodeEx() at 0xd2a72fa0 PyEval_EvalCode() at 0xd2a73044 run_node() at 0xd2a69e60 run_err_node_65_14() at 0xd2a6c2a4 run_err_node() at 0xd2a69ed8 PyRun_FileExFlags() at 0xd2a6ac10 PyRun_SimpleFileExFlags() at 0xd2a6b57c PyRun_AnyFileExFlags() at 0xd2a6b7cc Py_Main() at 0xd2af796c .() at 0x10002084 Regards, Chris From m.sloyko at gmail.com Sun Jan 7 16:24:15 2007 From: m.sloyko at gmail.com (Maxim Sloyko) Date: Sun, 7 Jan 2007 18:24:15 +0300 Subject: [lxml-dev] lxml namespaces Message-ID: <987377390701070724ua506a6cpa2459777a90bfa70@mail.gmail.com> Hi All! I have a little problem with XML namespaces. In my application I have two XML processors, that process the same document, one after the other. The first one looks for nodes in 'ns1' namespace, and substitutes them, according to some algorithm. After this processor is finished, it is guaranteed that there are no more 'ns1' nodes left in the tree. 'ns1' namespace dclaration is still there, in the root node (well, I put it there manually). Now, when this namespace is no longer needed, I want to get rid of it, because it confuses some other processors (namely, my browser) So, the question is, how do I do that? del tree.getroot().nsmap['ns1'] does not seem to do the trick :( Thanks in advance and Happy Holidays! -- Maxim Sloyko From m.sloyko at gmail.com Mon Jan 8 12:50:53 2007 From: m.sloyko at gmail.com (Maxim Sloyko) Date: Mon, 8 Jan 2007 14:50:53 +0300 Subject: [lxml-dev] [repost] lxml namespaces In-Reply-To: <987377390701070724ua506a6cpa2459777a90bfa70@mail.gmail.com> References: <987377390701070724ua506a6cpa2459777a90bfa70@mail.gmail.com> Message-ID: <987377390701080350j2e47f867lb41817385595fd68@mail.gmail.com> Hi All! Sorry for the repost, but my first message does not seem to reach this list... :( I have a little problem with XML namespaces. In my application I have two XML processors, that process the same document, one after the other. The first one looks for nodes in 'ns1' namespace, and substitutes them, according to some algorithm. After this processor is finished, it is guaranteed that there are no more 'ns1' nodes left in the tree. 'ns1' namespace dclaration is still there, in the root node (well, I put it there manually). Now, when this namespace is no longer needed, I want to get rid of it, because it confuses some other processors (namely, my browser) So, the question is, how do I do that? del tree.getroot().nsmap['ns1'] does not seem to do the trick :( Thanks in advance and Happy Holidays! -- Maxim Sloyko From listsub at wickedgrey.com Tue Jan 9 04:31:37 2007 From: listsub at wickedgrey.com (Eli Stevens (WG.c)) Date: Mon, 08 Jan 2007 19:31:37 -0800 Subject: [lxml-dev] PyThread_release_lock segmentation fault Message-ID: <45A30C99.6000909@wickedgrey.com> Hello, I'm getting segmentation faults inside PyThread_release_lock when trying to use lxml 1.1.2. The various stack traces I have seen seem to vary, but they are all related to "__xmlRaiseError () from /usr/lib/libxml2.so.2" (I haven't produced very many test cases, so there might be other causes). The original lxml install was done with easy_install, but I get the same results when I test the source directly. I'm using libxml2-2.6.27, gcc 3.4.3, and python 2.4 on a relatively recent redhat install. I am able to use the standard libxml2 python bindings, so I don't think there is an issue with the libxml2 install. I installed the svn trunk-and-pyrex, and was able to compile and run make test, but the tests failed with a number of errors that seemed to be expected for using the dev trunk (wrong functionality, not segfaults). lxml 1.1.1 also segfaults for me, which leads me to believe there might be a bugfix on the trunk that hasn't been released yet. If so, is there a revision that contains the change that works? Below is a log of my session (the most interesting part is probably the gdb stack trace down at the bottom). Here are the commands I entered: gcc -v python ^D make clean make test gdb python run test.py bt Can anyone tell if this is a problem on my end, or on lxml's? Is there any more information that I can provide that might be of use? Sorry if all this is a bit verbose. :) Thanks, Eli --- elis at mapdev4:~/edit/external/tarball/lxml-1.1.2/src/lxml> gcc -v Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux Thread model: posix gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.1) elis at mapdev4:~/edit/external/tarball/lxml-1.1.2/src/lxml> python Python 2.4 (#1, Nov 30 2004, 11:25:14) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> elis at mapdev4:~/edit/external/tarball/lxml-1.1.2> make clean find . \( -name '*.o' -o -name '*.c' -o -name '*.so' -o -name '*.py[cod]' -o -name '*.dll' \) -exec rm -f {} \; rm -rf build elis at mapdev4:~/edit/external/tarball/lxml-1.1.2> make test python setup.py build_ext -i Building lxml version 1.1.2 running build_ext building 'lxml.etree' extension creating build creating build/temp.linux-i686-2.4 creating build/temp.linux-i686-2.4/src creating build/temp.linux-i686-2.4/src/lxml gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.4 -c src/lxml/etree.c -o build/temp.linux-i686-2.4/src/lxml/etree.o -w -I/usr/local/include -I/usr/local/include/libxml2 gcc -pthread -shared build/temp.linux-i686-2.4/src/lxml/etree.o -o src/lxml/etree.so -L/usr/local/lib -lexslt -lxslt -lxml2 -lz -lm building 'lxml.objectify' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.4 -c src/lxml/objectify.c -o build/temp.linux-i686-2.4/src/lxml/objectify.o -w -I/usr/local/include -I/usr/local/include/libxml2 gcc -pthread -shared build/temp.linux-i686-2.4/src/lxml/objectify.o -o src/lxml/objectify.so -L/usr/local/lib -lexslt -lxslt -lxml2 -lz -lm python test.py -p -v TESTED VERSION: Python: (2, 4, 0, 'final', 0) lxml.etree: (1, 1, 2, 0) libxml used: (2, 6, 16) libxml compiled: (2, 6, 27) libxslt used: (1, 1, 11) libxslt compiled: (1, 1, 19) 1/656 ( 0.2%): test_attribute_based_lookup (lxml.tests.test_classlookup.ClassLookupTestCase)make: *** [test_inplace] Segmentation fault elis at mapdev4:~/edit/external/tarball/lxml-1.1.2> gdb python GNU gdb Red Hat Linux (6.3.0.0-0.31rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...(no debugging symbols found) Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) run test.py Starting program: /usr/local/bin/python test.py (no debugging symbols found) [Thread debugging using libthread_db enabled] [New Thread -1207994688 (LWP 25687)] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) TESTED VERSION: Python: (2, 4, 0, 'final', 0) lxml.etree: (1, 1, 2, 0) libxml used: (2, 6, 16) libxml compiled: (2, 6, 27) libxslt used: (1, 1, 11) libxslt compiled: (1, 1, 19) Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1207994688 (LWP 25687)] 0x00a10b4a in sem_post at GLIBC_2.0 () from /lib/tls/libpthread.so.0 (gdb) bt #0 0x00a10b4a in sem_post at GLIBC_2.0 () from /lib/tls/libpthread.so.0 #1 0x080de5e2 in PyThread_release_lock () #2 0x0012430f in __pyx_f_5etree__receiveError (__pyx_v_c_log_handler=0xb7c42bcc, __pyx_v_error=0x9b5e308) at src/lxml/etree.c:15789 #3 0x00383ccc in __xmlRaiseError () from /usr/lib/libxml2.so.2 #4 0x0038525e in xmlKeepBlanksDefault () from /usr/lib/libxml2.so.2 #5 0x0040e58f in xmlSkipBlankChars () from /usr/lib/libxml2.so.2 #6 0x0041204a in xmlParseElement () from /usr/lib/libxml2.so.2 #7 0x003749ae in xmlParseDocument () from /usr/lib/libxml2.so.2 #8 0x00374b71 in xmlCleanupParser () from /usr/lib/libxml2.so.2 #9 0x00186726 in __pyx_f_5etree_11_BaseParser__parseDoc (__pyx_v_self=0x0, __pyx_v_c_text=0xb7fda8d4 "\n \n 0\n 1\n 2\n \n", __pyx_v_c_len=159, __pyx_v_c_filename=0x0) at src/lxml/etree.c:20945 #10 0x00137132 in __pyx_f_5etree__parseMemoryDocument (__pyx_v_text=0xb7fda8c0, __pyx_v_url=0x8118bc0, __pyx_v_parser=0xb7c4466c) at src/lxml/etree.c:22182 #11 0x0016accc in __pyx_f_5etree_XML (__pyx_self=0x0, __pyx_args=0xb7ad0bac, __pyx_kwds=0x0) at src/lxml/etree.c:9712 #12 0x080b5122 in PyEval_EvalFrame () #13 0x080b569c in PyEval_EvalFrame () #14 0x080b5e22 in PyEval_EvalCodeEx () #15 0x080fcd9a in function_call () #16 0x0805bdb0 in PyObject_Call () #17 0x080641d5 in instancemethod_call () #18 0x0805bdb0 in PyObject_Call () #19 0x0808f352 in slot_tp_call () #20 0x0805bdb0 in PyObject_Call () #21 0x080b0e6d in PyEval_EvalFrame () #22 0x080b5e22 in PyEval_EvalCodeEx () #23 0x080fcd9a in function_call () #24 0x0805bdb0 in PyObject_Call () #25 0x080641d5 in instancemethod_call () #26 0x0805bdb0 in PyObject_Call () #27 0x0808f352 in slot_tp_call () #28 0x0805bdb0 in PyObject_Call () #29 0x080b0e6d in PyEval_EvalFrame () #30 0x080b569c in PyEval_EvalFrame () #31 0x080b569c in PyEval_EvalFrame () #32 0x080b5e22 in PyEval_EvalCodeEx () #33 0x080b5f8a in PyEval_EvalCode () #34 0x080d9f4c in PyRun_FileExFlags () #35 0x080da82e in PyRun_SimpleFileExFlags () #36 0x0805560f in Py_Main () #37 0x08054e3f in main () From Holger.Joukl at LBBW.de Tue Jan 9 10:20:04 2007 From: Holger.Joukl at LBBW.de (Holger Joukl) Date: Tue, 9 Jan 2007 10:20:04 +0100 Subject: [lxml-dev] PyThread_release_lock segmentation fault In-Reply-To: <45A30C99.6000909@wickedgrey.com> Message-ID: Hi, lxml-dev-bounces at codespeak.net schrieb am 09.01.2007 04:31:37: > Hello, > > I'm getting segmentation faults inside PyThread_release_lock when trying > to use lxml 1.1.2. The various stack traces I have seen seem to vary, > but they are all related to "__xmlRaiseError () from > /usr/lib/libxml2.so.2" (I haven't produced very many test cases, so > there might be other causes). The original lxml install was done with > easy_install, but I get the same results when I test the source directly. > > I'm using libxml2-2.6.27, gcc 3.4.3, and python 2.4 on a relatively > recent redhat install. No segfaults on my solaris system using gcc 2.95.2, libxml-2.6.27, libxslt-1.1.18 and python 2.4.3. There's been some issues with segfaults due to errors raised from libxml lately which seemed to be correlated with python 2.3 and threading, you might want to take a look at the archives. I ran into some myself using python 2.3. Note that - my current version is a 1.1.2 branch snapshot taken some time ago - the "libxml used" and "libxml compiled" output is the same on my system, but not on yours (whatever that's supposed to mean) - I use a more recent Python 2.4 version (2.4.3); maybe the Python2.3-threading-lxml issue also extends to earlier Python 2.4-versions? Holger Here's my test log: $ PATH=/apps/pydev/bin:$PATH make test PYTHON=/apps/pydev/bin/python2.4 /apps/pydev/bin/python2.4 setup.py build_ext -i Building lxml version 1.1.2-33909 running build_ext /apps/pydev/bin/python2.4 test.py -p -v TESTED VERSION: Python: (2, 4, 3, 'final', 0) lxml.etree: (1, 1, 2, 33909) libxml used: (2, 6, 27) libxml compiled: (2, 6, 27) libxslt used: (1, 1, 18) libxslt compiled: (1, 1, 18) 477/477 (100.0%): Doctest: extensions.txt ====================================================================== ERROR: test_object_path_syntax (lxml.tests.test_objectify.ObjectifyTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/apps/prod//lib/python2.4/unittest.py", line 260, in run testMethod() File "/data/pydev/DOWNLOADS/LXML/lxml/lxml-1.1 /src/lxml/tests/test_objectify.py", line 544, in test_object_path_syntax self.assertEquals(root.c1.c2.text, path(root).text) File "objectify.pyx", line 1103, in objectify.ObjectPath.__call__ File "objectify.pyx", line 1244, in objectify._findObjectPath ValueError: root element does not match: need {objectified}root , got {objectified}root ====================================================================== FAIL: test_xslt_parameter_missing (lxml.tests.test_xslt.ETreeXSLTTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/apps/prod//lib/python2.4/unittest.py", line 260, in run testMethod() File "/data/pydev/DOWNLOADS/LXML/lxml/lxml-1.1 /src/lxml/tests/test_xslt.py", line 221, in test_xslt_parameter_missing st.apply, tree) File "/apps/prod//lib/python2.4/unittest.py", line 326, in failUnlessRaises raise self.failureException, "%s not raised" % excName AssertionError: XSLTApplyError not raised ---------------------------------------------------------------------- Ran 477 tests in 1.014s FAILED (failures=1, errors=1) make: *** [test_inplace] Error 1 Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene Empf?nger sind oder falls diese E-Mail irrt?mlich an Sie adressiert wurde, verst?ndigen Sie bitte den Absender sofort und l?schen Sie die E-Mail sodann. Das unerlaubte Kopieren sowie die unbefugte ?bermittlung sind nicht gestattet. Die Sicherheit von ?bermittlungen per E-Mail kann nicht garantiert werden. Falls Sie eine Best?tigung w?nschen, fordern Sie bitte den Inhalt der E-Mail als Hardcopy an. The contents of this e-mail are confidential. If you are not the named addressee or if this transmission has been addressed to you in error, please notify the sender immediately and then delete this e-mail. Any unauthorized copying and transmission is forbidden. E-Mail transmission cannot be guaranteed to be secure. If verification is required, please request a hard copy version. From faassen at startifact.com Tue Jan 9 23:05:43 2007 From: faassen at startifact.com (Martijn Faassen) Date: Tue, 09 Jan 2007 23:05:43 +0100 Subject: [lxml-dev] PyThread_release_lock segmentation fault In-Reply-To: References: <45A30C99.6000909@wickedgrey.com> Message-ID: Holger Joukl wrote: [snip] > - I use a more recent Python 2.4 version (2.4.3); maybe the > Python2.3-threading-lxml > issue also extends to earlier Python 2.4-versions? I recall it did happen in early Python 2.4 versions. The trunk scans for this and should work around this problem. Regards, Martijn From listsub at wickedgrey.com Wed Jan 10 07:13:47 2007 From: listsub at wickedgrey.com (Eli Stevens (WG.c)) Date: Tue, 09 Jan 2007 22:13:47 -0800 Subject: [lxml-dev] PyThread_release_lock segmentation fault In-Reply-To: References: <45A30C99.6000909@wickedgrey.com> Message-ID: <45A4841B.3010505@wickedgrey.com> Martijn Faassen wrote: > Holger Joukl wrote: > [snip] >> - I use a more recent Python 2.4 version (2.4.3); maybe the >> Python2.3-threading-lxml >> issue also extends to earlier Python 2.4-versions? > > I recall it did happen in early Python 2.4 versions. The trunk scans for > this and should work around this problem. Yes, I've installed the python 2.4.4 on the machine in question and after a recompile of lxml-1.1.2, everything seems to be working, minus a few test failures (that seemed to be the same as the ones on trunk?). Thanks for both your help looking into this, and apologies for using up your time with what was actually an unrelated issue (in my defense, the whole "1.1.2 fails/trunk works" is a nice bit of misdirection! ;). If nothing else, hopefully this thread will help the next person who runs into this corner case. :) Thanks again, Eli From faassen at startifact.com Wed Jan 10 11:36:38 2007 From: faassen at startifact.com (Martijn Faassen) Date: Wed, 10 Jan 2007 11:36:38 +0100 Subject: [lxml-dev] PyThread_release_lock segmentation fault In-Reply-To: <45A4841B.3010505@wickedgrey.com> References: <45A30C99.6000909@wickedgrey.com> <45A4841B.3010505@wickedgrey.com> Message-ID: Eli Stevens (WG.c) wrote: > Martijn Faassen wrote: >> Holger Joukl wrote: >> [snip] >>> - I use a more recent Python 2.4 version (2.4.3); maybe the >>> Python2.3-threading-lxml >>> issue also extends to earlier Python 2.4-versions? >> I recall it did happen in early Python 2.4 versions. The trunk scans for >> this and should work around this problem. > > Yes, I've installed the python 2.4.4 on the machine in question and > after a recompile of lxml-1.1.2, everything seems to be working, minus a > few test failures (that seemed to be the same as the ones on trunk?). Could you let us know which tests are failing? > Thanks for both your help looking into this, and apologies for using up > your time with what was actually an unrelated issue (in my defense, the > whole "1.1.2 fails/trunk works" is a nice bit of misdirection! ;). No problem at all. We need to do a release with this fix in there. Regards, Martijn From listsub at wickedgrey.com Sat Jan 13 02:08:35 2007 From: listsub at wickedgrey.com (Eli Stevens (WG.c)) Date: Fri, 12 Jan 2007 17:08:35 -0800 Subject: [lxml-dev] PyThread_release_lock segmentation fault In-Reply-To: References: <45A30C99.6000909@wickedgrey.com> <45A4841B.3010505@wickedgrey.com> Message-ID: <45A83113.8060602@wickedgrey.com> Martijn Faassen wrote: > Could you let us know which tests are failing? Hello, The test failures that I mentioned in a previous message were due to there being an older version of libxml2 installed on the machine I was using (I don't administer the machine, and I hadn't realized it was lurking around). This was the cause of the mismatched versions that Holger noticed: TESTED VERSION: Python: (2, 4, 0, 'final', 0) lxml.etree: (1, 1, 2, 0) libxml used: (2, 6, 16) libxml compiled: (2, 6, 27) libxslt used: (1, 1, 11) libxslt compiled: (1, 1, 19) I'm getting one more test failure, but since I've got two versions of libxml2, two versions of python 2.4 and two versions of lxml all installed on this machine, I suspect the problem is that just mismatched configurations on my end. Just in case, I've copied the test failure below, but I really think that it's a problem on the machine I'm using. Eli elis at mapdev4:~/edit/external/tarball/lxml-1.1.2> make test /homes/elis/bin/python setup.py build_ext -i Building lxml version 1.1.2 running build_ext /homes/elis/bin/python test.py -p -v TESTED VERSION: Python: (2, 4, 4, 'final', 0) lxml.etree: (1, 1, 2, 0) libxml used: (2, 6, 27) libxml compiled: (2, 6, 27) libxslt used: (1, 1, 19) libxslt compiled: (1, 1, 19) 477/477 (100.0%): Doctest: extensions.txt ====================================================================== FAIL: test_xslt_parameter_missing (lxml.tests.test_xslt.ETreeXSLTTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/homes/elis/lib/python2.4/unittest.py", line 260, in run testMethod() File "/homes/elis/edit/external/tarball/lxml-1.1.2/src/lxml/tests/test_xslt.py", line 221, in test_xslt_parameter_missing st.apply, tree) File "/homes/elis/lib/python2.4/unittest.py", line 326, in failUnlessRaises raise self.failureException, "%s not raised" % excName AssertionError: XSLTApplyError not raised ---------------------------------------------------------------------- Ran 477 tests in 0.464s FAILED (failures=1) make: *** [test_inplace] Error 1 From listsub at wickedgrey.com Sat Jan 13 02:09:03 2007 From: listsub at wickedgrey.com (Eli Stevens (WG.c)) Date: Fri, 12 Jan 2007 17:09:03 -0800 Subject: [lxml-dev] lxml HTMLParser changes the resulting tree Message-ID: <45A8312F.1030801@wickedgrey.com> This is using lxml 1.1.2, note the "p" tag: >>> html = "


" >>> parser = etree.HTMLParser() >>> et = etree.parse(StringIO(html), parser) >>> print etree.tostring(et.getroot())


Now, p tags aren't supposed to contain block level elements: http://www.w3.org/TR/html401/struct/text.html#h-9.3.1 But the page that I'm seeing in the wild is structured that way, and I'd really like it if I could get a tree that represented the original file as closely as possible, even if it's semantically incorrect html (I like it closing
tags and such, but I'd really like to be able to, say, round-trip the data). Any idea if this is possible? Should I be taking this up with the libxml2 folks? Thanks, Eli From lee.brown at elecdev.com Mon Jan 15 18:45:56 2007 From: lee.brown at elecdev.com (Lee Brown) Date: Mon, 15 Jan 2007 12:45:56 -0500 Subject: [lxml-dev] Namespace handling problems in LXML 1.1.1 In-Reply-To: <45A8312F.1030801@wickedgrey.com> Message-ID: <200701151745.l0FHjh0e006983@mail.elecdev.com> Greetings! I've run into a few snags related to namespace handling in LXML 1.1.1 (I'm using the bundled Windows distribution). First, given an lxml tree object created from an xml file with a root element that goes something like this: One might expect that the namespace definitions would be preserved upon reserialization. Unfortunately, they are not; what you get using the tostring() function is just . Is there some function or keyword in lxml that will case the namespace definitions to be re-mapped into the output? I've tried to find such a thing if it exists using the docstrings and introspection but I've come up empty-handed. Second, one might think that the nsmap attribute would be 'just the ticket' for performing xpath searches: elements = mytree.xpath('//fred:someelement', mytree.getroot().nsmap) But this fails, because (following from the first example above) the nsmap attribute for yeilds {None:'ns1', 'fred':'ns2', 'bob':'ns3'} Note: the above xpath search succeeds if the None:'ns1' namespace is deleted from nsmap. Using a NoneType as a key in nsmap causes it to be unusable as far as the xpath function is concerned (and probably some other places as well.) Is there any workaround, other than creating (and updating) my own namespace dictionary within my code? Finally, if someone wants to suggest any 'best practices' for working with namespaces in lxml, I'd be very interested in reading them. From lee.brown at elecdev.com Mon Jan 15 19:39:29 2007 From: lee.brown at elecdev.com (Lee Brown) Date: Mon, 15 Jan 2007 13:39:29 -0500 Subject: [lxml-dev] Namespace handling problems in LXML 1.1.1 In-Reply-To: <200701151745.l0FHjh0e006983@mail.elecdev.com> Message-ID: <200701151839.l0FIdF0e007936@mail.elecdev.com> Sorry, I made a serious mistake in my last message. For clarity, toss the whole thing and use this instead: Greetings! I've run into a few snags related to namespace handling in LXML 1.1.1 (I'm using the bundled Windows distribution). First, I had hoped that the namespaces defined in the tree's root element nsmap attribute could be automatically included upon re-serialization. For example, given this source xml: Split off into a new tree: newtree = etree.ElementTree(element) And then reserialize newtree: result = etree.tostring(newtree.getroot()) Even though the root element of newtree contains the same nsmap as the source tree, the resulting output is and not Is there some function or keyword in lxml that will case the namespace definitions in the nsmap attribute to be re-mapped into the output? I've tried to find such a thing if it exists using the docstrings and introspection but I've come up empty-handed. Second, one might think that the nsmap attribute would be 'just the ticket' for performing xpath searches: elements = mytree.xpath('//fred:someelement', mytree.getroot().nsmap) But this fails, because (following from the first example above) the nsmap attribute for yeilds {None:'ns1', 'fred':'ns2', 'bob':'ns3'} Note: the above xpath search succeeds if the None:'ns1' namespace is deleted from nsmap. Using a NoneType as a key in nsmap causes it to be unusable as far as the xpath function is concerned (and probably some other places as well.) Is there any workaround, other than creating (and updating) my own namespace dictionary within my code? From lee.brown at elecdev.com Tue Jan 16 17:43:18 2007 From: lee.brown at elecdev.com (Lee Brown) Date: Tue, 16 Jan 2007 11:43:18 -0500 Subject: [lxml-dev] Namespace handling problems in LXML 1.1.1 In-Reply-To: <200701151839.l0FIdF0e007936@mail.elecdev.com> Message-ID: <200701161643.l0GGhE0e023184@mail.elecdev.com> Greetings! Here is the problem, as clearly as I can state it: I want to take an xml document, split an element out of it, and use that element as the root of a new document, AND preserve the original document's namespace definitions in the new document. # --- Test 1 --- # tree1 = etree.ElementTree(etree.fromstring('boo')) print tree1.getroot().nsmap print etree.tostring(tree1.getroot()) tree2 = etree.ElementTree(tree1.getroot().find('{ns1}element')) print tree2.getroot().nsmap print etree.tostring(tree2.getroot()) # --- Test 2 --- # nsdict = {'pre':'ns1'} tree1 = etree.ElementTree(etree.fromstring('boo')) print tree1.getroot().nsmap print etree.tostring(tree1.getroot()) tree2 = etree.ElementTree(tree1.getroot().xpath('//pre:element', nsdict)[0]) print tree2.getroot().nsmap print etree.tostring(tree2.getroot()) # --- Test 3 --- # nsdict = {'pre':'ns1'} tree1 = etree.ElementTree(etree.fromstring('boo')) print tree1.getroot().nsmap print etree.tostring(tree1.getroot()) tree2 = etree.ElementTree(tree1.getroot().xpath('//pre:element', nsdict)[0]) print tree2.getroot().nsmap print etree.tostring(tree2.getroot()) In each of the three tests above, the root element of tree2 does indeed contain an nsmap with the correct values, but they are not being written out during reserialization. Is there any to fix this, other than manually adding the definitions as simple attributes just before saving the new document? From Holger.Joukl at LBBW.de Tue Jan 23 14:04:35 2007 From: Holger.Joukl at LBBW.de (Holger Joukl) Date: Tue, 23 Jan 2007 14:04:35 +0100 Subject: [lxml-dev] AssertionError: double registering proxy! Message-ID: Hi, I'm using such code cache = {} cache[msg] = list(msg.getiterator()) to speed up subsequent tree access in my application, keeping proxied Elements alive. I've now run into AssertionError: double registering proxy! errors: 2007/01/23 13:25:43:all2all_MainThread:ERROR: outmsg = self.mapper(msg) 2007/01/23 13:25:43:all2all_MainThread:ERROR: File "/data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/pytaf/mapper/FieldSelector.py", line 60, in __call__ 2007/01/23 13:25:43:all2all_MainThread:ERROR: cache[msg] = list(msg.getiterator()) 2007/01/23 13:25:43:all2all_MainThread:ERROR: File "etree.pyx", line 1562, in etree.ElementDepthFirstIterator.__next__ 2007/01/23 13:25:43:all2all_MainThread:ERROR: File "etree.pyx", line 1207, in etree._elementFactory 2007/01/23 13:25:43:all2all_MainThread:ERROR: File "proxy.pxi", line 28, in etree.registerProxy 2007/01/23 13:25:43:all2all_MainThread:ERROR:: AssertionError: double registering proxy! I've not really an idea how that happens. This is a threaded program; might that be a problem? I'm using Python 2.4.3, lxml 1.1.2, libxml2 2.6.27, libxslt 1.1.18. Holger Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene Empf?nger sind oder falls diese E-Mail irrt?mlich an Sie adressiert wurde, verst?ndigen Sie bitte den Absender sofort und l?schen Sie die E-Mail sodann. Das unerlaubte Kopieren sowie die unbefugte ?bermittlung sind nicht gestattet. Die Sicherheit von ?bermittlungen per E-Mail kann nicht garantiert werden. Falls Sie eine Best?tigung w?nschen, fordern Sie bitte den Inhalt der E-Mail als Hardcopy an. The contents of this e-mail are confidential. If you are not the named addressee or if this transmission has been addressed to you in error, please notify the sender immediately and then delete this e-mail. Any unauthorized copying and transmission is forbidden. E-Mail transmission cannot be guaranteed to be secure. If verification is required, please request a hard copy version. From Holger.Joukl at LBBW.de Wed Jan 24 12:03:52 2007 From: Holger.Joukl at LBBW.de (Holger Joukl) Date: Wed, 24 Jan 2007 12:03:52 +0100 Subject: [lxml-dev] bus error core dump lxml 1.1.2 Message-ID: Hi, I just ran into a Bus Error (Core dump) with a threaded program on a Solaris 8 system, using Python 2.4.3, lxml 1.1.2-33909, libxml2 2.6.27, libxslt 1.1.18. No clue if that points to a bug in lxml or in libxml2. Right now I'm also not able to reproduce this reliably or provide some minimal example. Alas, here's what gdb says: $ gdb /apps/pydev/bin/python2.4 -c current/bin/core -directory=/data/pydev/DOWNLOADS/LXML/lxml/lxml-1.1 /src/lxml:/data/pydev/DOWNLOADS/LXML/libxml2/libxml2-2.6.27 GNU gdb 4.18 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.6"... warning: core file may not match specified executable file. Core was generated by `/apps/pydev/bin/python2.4 ./current/bin/all2all.py'. Program terminated with signal 9, Killed. Reading symbols from /usr/lib/libresolv.so.2...done. Reading symbols from /usr/lib/libsocket.so.1...done. Reading symbols from /usr/lib/libnsl.so.1...done. Reading symbols from /usr/lib/librt.so.1...done. Reading symbols from /usr/lib/libdl.so.1...done. Reading symbols from /usr/lib/libpthread.so.1...done. Reading symbols from /usr/lib/libm.so.1...done. Reading symbols from /usr/lib/libc.so.1...done. Reading symbols from /usr/lib/libmp.so.2...done. Reading symbols from /usr/lib/libaio.so.1...done. Reading symbols from /usr/platform/SUNW,Sun-Fire-V440/lib/libc_psr.so.1...done. Reading symbols from /usr/lib/libthread.so.1...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/time.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/strop.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/collections.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/time64.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/rv/rv.so...done. Reading symbols from /apps/prod/rmds/tibrv7/lib/libtibrv.so...done. Reading symbols from /apps/prod/lib/libstdc++.so.2.10.0...done. Reading symbols from /usr/lib/libgen.so.1...done. Reading symbols from /usr/lib/libkstat.so.1...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/rv/rvcm.so...done. Reading symbols from /apps/prod/rmds/tibrv7/lib/libtibrvcm.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/lxml/etree.so...done. Reading symbols from /apps/pydev/lib/libexslt.so.0...done. Reading symbols from /apps/pydev/lib/libxslt.so.1...done. Reading symbols from /apps/pydev/lib/libxml2.so.2...done. Reading symbols from /apps/prod//lib/libz.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/lxml/objectify.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/itertools.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/datetime.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/struct.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/cStringIO.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/statvfs_ex.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/gdbm.so...done. Reading symbols from /apps/prod/lib/libgdbm.so.2...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/_socket.so...done. ---Type to continue, or q to quit--- Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/_ssl.so...done. Reading symbols from /usr/lib/libssl.so.0.9.6...done. Reading symbols from /usr/lib/libcrypto.so.0.9.6...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/zlib.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/fconvert.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/pytaf/connect/tibrv/cxxutils.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/operator.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/fixeddecimal.so...done. Reading symbols from /data/pydev/hjoukl/PyTAF/pytaf/__PytafTestInstallation__/2006-Q3-BETA/lib/python2.4/site-packages/sfc.so...done. Reading symbols from /usr/lib/libCstd.so.1...done. Reading symbols from /usr/lib/libCrun.so.1...done. Reading symbols from /apps/prod/rmds/versions/sslcpp4.4.4.L1.solaris.rrg/lib/solaris2.6-sw53/static/libssl.so...done. Reading symbols from /usr/lib/cpu/sparcv8plus/libCstd_isa.so.1...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/md5.so...done. Reading symbols from /apps/pydev/lib/python2.4/lib-dynload/grp.so...done. #0 xmlNodeDumpOutputInternal (ctxt=0xfcf0c1d0, cur=0x115da10) at xmlsave.c:764 764 if ((tmp->type == XML_TEXT_NODE) || (gdb) list 759 760 format = ctxt->format; 761 if (format == 1) { 762 tmp = cur->children; 763 while (tmp != NULL) { 764 if ((tmp->type == XML_TEXT_NODE) || 765 (tmp->type == XML_CDATA_SECTION_NODE) || 766 (tmp->type == XML_ENTITY_REF_NODE)) { 767 ctxt->format = 0; 768 break; (gdb) where full #0 xmlNodeDumpOutputInternal (ctxt=0xfcf0c1d0, cur=0x115da10) at xmlsave.c:764 format = 1 tmp = 0x280000e start = (xmlChar *) 0x115da10 "\001\013aX\231U??" end = (xmlChar *) 0xfcf0c1d0 "" buf = 0x11c59b0 #1 0xfdf95910 in xmlNodeListDumpOutput (ctxt=0xfcf0c1d0, cur=0x115da10) at xmlsave.c:631 buf = 0x11c59b0 #2 0xfdf95ea0 in xmlNodeDumpOutputInternal (ctxt=0xfcf0c1d0, cur=0x10d4268) at xmlsave.c:798 format = 1 tmp = 0x115da10 start = (xmlChar *) 0x10d4268 "\001\022?`" end = (xmlChar *) 0xfcf0c1d0 "" buf = 0x11c59b0 #3 0xfdf95910 in xmlNodeListDumpOutput (ctxt=0xfcf0c1d0, cur=0x10d4268) at xmlsave.c:631 buf = 0x11c59b0 #4 0xfdf95ea0 in xmlNodeDumpOutputInternal (ctxt=0xfcf0c1d0, cur=0xea4c90) at xmlsave.c:798 format = 1 tmp = 0x10d4268 start = (xmlChar *) 0xea4c90 "\001\022?(" end = (xmlChar *) 0xfcf0c1d0 "" buf = 0x11c59b0 #5 0xfdf95910 in xmlNodeListDumpOutput (ctxt=0xfcf0c1d0, cur=0xea4c90) at xmlsave.c:631 buf = 0x11c59b0 #6 0xfdf95ea0 in xmlNodeDumpOutputInternal (ctxt=0xfcf0c1d0, cur=0x10e8460) at xmlsave.c:798 format = 1 tmp = 0xea4c90 start = (xmlChar *) 0x10e8460 "\001\032M(" end = (xmlChar *) 0xfcf0c1d0 "" buf = 0x11c59b0 #7 0xfdf97c68 in xmlNodeDumpOutput (buf=0x11c59b0, doc=0x10b5e08, cur=0x10e8460, level=0, format=1, encoding=0x11138a4 "ISO-8859-1") at xmlsave.c:2015 ctxt = { _private = 0x0, type = 0, fd = 0, filename = 0x0, encoding = 0x11138a4 "ISO-8859-1", handler = 0x0, buf = 0x11c59b0, doc = 0x10b5e08, options = 0, level = 3, format = 1, indent = ' ' , indent_nr = 30, indent_size = 2, escape = 0, escapeAttr = 0 } dtd = 0xfcf0c1d0 is_xhtml = 0 ---Type to continue, or q to quit--- #8 0xfe10d188 in __pyx_f_5etree__writeNodeToBuffer (__pyx_v_c_buffer=0x11c59b0, __pyx_v_c_node=0x10e8460, __pyx_v_encoding=0x11138a4 "ISO-8859-1", __pyx_v_write_xml_declaration=1, __pyx_v_pretty_print=1) at src/lxml/etree.c:23043 __pyx_v_c_doc = (xmlDoc *) 0x10b5e08 #9 0xfe0cec8c in __pyx_f_5etree__tostring (__pyx_v_element=0x11a4d28, __pyx_v_encoding=0x1113890, __pyx_v_write_xml_declaration=1, __pyx_v_pretty_print=1) at src/lxml/etree.c:22818 __pyx_v_state = (PyThreadState *) 0x6af870 __pyx_v_c_buffer = (xmlOutputBuffer *) 0x11c59b0 __pyx_v_c_result_buffer = (xmlBuffer *) 0x1 __pyx_v_enchandler = (xmlCharEncodingHandler *) 0x6af870 __pyx_v_c_enc = 0x11138a4 "ISO-8859-1" __pyx_v_result = (PyObject *) 0x10905c __pyx_r = (PyObject *) 0x109000 __pyx_1 = 1 __pyx_2 = 0x6af870 "" __pyx_3 = (PyObject *) 0x0 __pyx_4 = (PyObject *) 0x0 __pyx_5 = (PyObject *) 0x0 #10 0xfe0ab780 in __pyx_f_5etree_tostring (__pyx_self=0x0, __pyx_args=0x1, __pyx_kwds=0x0) at src/lxml/etree.c:10045 __pyx_v_element_or_tree = (PyObject *) 0x11a4d28 __pyx_v_encoding = (PyObject *) 0x1113890 __pyx_v_xml_declaration = (PyObject *) 0x122acc __pyx_v_pretty_print = (PyObject *) 0x122acc __pyx_v_write_declaration = 1 __pyx_v_c_pretty_print = 1 __pyx_r = (PyObject *) 0x0 __pyx_1 = 1 __pyx_2 = (PyObject *) 0x0 __pyx_3 = (PyObject *) 0x0 __pyx_4 = (PyObject *) 0x0 __pyx_5 = (PyObject *) 0x0 __pyx_argnames = {0xfe116968 "element_or_tree", 0xfe115808 "encoding", 0xfe1157e8 "xml_declaration", 0xfe1157f8 "pretty_print", 0x0} #11 0xdb038 in PyCFunction_Call (func=0x221620, arg=0x5abed0, kw=0x117dae0) at Objects/methodobject.c:77 meth = 0xfe0ab008 <__pyx_f_5etree_tostring> self = (PyObject *) 0x0 size = 0 #12 0x26028 in PyObject_Call (func=0x221620, arg=0x5abed0, kw=0x117dae0) at Objects/abstract.c:1795 result = (PyObject *) 0x221620 call = 0xdafc8 #13 0x8a514 in do_call (func=0x221620, pp_stack=0xfcf0c650, na=-1, nk=5947088) at Python/ceval.c:3771 callargs = (PyObject *) 0x5abed0 kwdict = (PyObject *) 0x117dae0 result = (PyObject *) 0x0 #14 0x88324 in call_function (pp_stack=0xfcf0c650, oparg=1) at Python/ceval.c:3586 na = 1 nk = 3 n = 7 ---Type to continue, or q to quit--- pfunc = (PyObject **) 0xeebf3c func = (PyObject *) 0x221620 x = (PyObject *) 0xfcf0c650 w = (PyObject *) 0xfcf0c650 #15 0x8565c in PyEval_EvalFrame (f=0xeebdd8) at Python/ceval.c:2163 sp = (PyObject **) 0xeebf40 stack_pointer = (PyObject **) 0xeebf5c next_instr = (unsigned char *) 0x1b1525 "|" opcode = 131 oparg = 769 why = WHY_NOT err = 0 x = (PyObject *) 0x122acc v = (PyObject *) 0x416558 w = (PyObject *) 0x224a20 u = (PyObject *) 0x6 t = (PyObject *) 0x301 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0xeebf24 freevars = (PyObject **) 0xeebf3c retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x2267e0 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x1b14b4 "t" names = (PyObject *) 0x1d8730 consts = (PyObject *) 0x20b998 #16 0x86b14 in PyEval_EvalCodeEx (co=0x2267e0, globals=0x0, locals=0xeebdd8, args=0x11139ec, argcount=3, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2736 kwcount = 0 closure = (PyObject *) 0xeebdd8 f = (PyFrameObject *) 0xeebdd8 retval = (PyObject *) 0x0 fastlocals = (PyObject **) 0xeebf24 freevars = (PyObject **) 0xeebf3c tstate = (PyThreadState *) 0x6af870 x = (PyObject *) 0x0 u = (PyObject *) 0xc #17 0xda520 in function_call (func=0x269670, arg=0x11139e0, kw=0x0) at Objects/funcobject.c:548 result = (PyObject *) 0x269670 argdefs = (PyObject *) 0x0 d = (PyObject **) 0x0 k = (PyObject **) 0x0 nk = 0 nd = 0 #18 0x26028 in PyObject_Call (func=0x269670, arg=0x11139e0, kw=0x0) at Objects/abstract.c:1795 result = (PyObject *) 0x269670 call = 0xda3d8 #19 0x2e088 in instancemethod_call (func=0x269670, arg=0x11139e0, kw=0x0) at Objects/classobject.c:2447 self = (PyObject *) 0x416558 ---Type to continue, or q to quit--- class = (PyObject *) 0x2 result = (PyObject *) 0x269670 #20 0x26028 in PyObject_Call (func=0x269670, arg=0x11139e0, kw=0x0) at Objects/abstract.c:1795 result = (PyObject *) 0x1c7918 call = 0x2de70 #21 0x2d76c in instance_call (func=0x416558, arg=0x5bda30, kw=0x0) at Objects/classobject.c:2004 res = (PyObject *) 0x416558 call = (PyObject *) 0x1c7918 #22 0x26028 in PyObject_Call (func=0x416558, arg=0x5bda30, kw=0x0) at Objects/abstract.c:1795 result = (PyObject *) 0x416558 call = 0x2d6ac #23 0x8a514 in do_call (func=0x416558, pp_stack=0xfcf0cd50, na=-1, nk=6019632) at Python/ceval.c:3771 callargs = (PyObject *) 0x5bda30 kwdict = (PyObject *) 0x0 result = (PyObject *) 0x0 #24 0x88324 in call_function (pp_stack=0xfcf0cd50, oparg=2) at Python/ceval.c:3586 na = 2 nk = 0 n = 2 pfunc = (PyObject **) 0x116bde0 func = (PyObject *) 0x416558 x = (PyObject *) 0xfcf0cd50 w = (PyObject *) 0xfcf0cd50 #25 0x8565c in PyEval_EvalFrame (f=0x116bc70) at Python/ceval.c:2163 sp = (PyObject **) 0x116bde4 stack_pointer = (PyObject **) 0x116bdec next_instr = (unsigned char *) 0x2865e0 "|" opcode = 131 oparg = 2 why = WHY_NOT err = 0 x = (PyObject *) 0x28e020 v = (PyObject *) 0x416530 w = (PyObject *) 0x150780 u = (PyObject *) 0x5b7cd8 t = (PyObject *) 0x2 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0x116bdbc freevars = (PyObject **) 0x116bdd8 retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x3dbc20 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x286574 "t" names = (PyObject *) 0x26cab0 consts = (PyObject *) 0x2c2dc0 #26 0x86b14 in PyEval_EvalCodeEx (co=0x3dbc20, globals=0x0, locals=0x116bc70, args=0xea400, argcount=959488, kws=0xea400, kwcount=1, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2736 kwcount = 1 closure = (PyObject *) 0x116bc70 ---Type to continue, or q to quit--- f = (PyFrameObject *) 0x116bc70 retval = (PyObject *) 0x0 fastlocals = (PyObject **) 0x116bdbc freevars = (PyObject **) 0x116bdd8 tstate = (PyThreadState *) 0x6af870 x = (PyObject *) 0x0 u = (PyObject *) 0x4 #27 0x884e4 in fast_function (func=0x3e2d30, pp_stack=0xfcf0cfa0, n=5, na=959488, nk=1) at Python/ceval.c:3656 co = (PyCodeObject *) 0xea000 globals = (PyObject *) 0x0 argdefs = (PyObject *) 0x12dc00 d = (PyObject **) 0x2a nd = 0 #28 0x8830c in call_function (pp_stack=0xfcf0cfa0, oparg=3) at Python/ceval.c:3584 na = 3 nk = 1 n = 5 pfunc = (PyObject **) 0xec5a60 func = (PyObject *) 0x3e2d30 x = (PyObject *) 0xfcf0cfa0 w = (PyObject *) 0xfcf0cfa0 #29 0x8565c in PyEval_EvalFrame (f=0xec58e8) at Python/ceval.c:2163 sp = (PyObject **) 0xec5a74 stack_pointer = (PyObject **) 0xec5a74 next_instr = (unsigned char *) 0x3c87d7 "\001|" opcode = 131 oparg = 258 why = WHY_NOT err = 0 x = (PyObject *) 0x4163a0 v = (PyObject *) 0x416418 w = (PyObject *) 0x1738a0 u = (PyObject *) 0x113fbc0 t = (PyObject *) 0x102 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0xec5a34 freevars = (PyObject **) 0xec5a5c retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x3db120 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x3c86d4 "t" names = (PyObject *) 0x279be0 consts = (PyObject *) 0x2c3df0 #30 0x86b14 in PyEval_EvalCodeEx (co=0x3db120, globals=0x0, locals=0xec58e8, args=0xea400, argcount=959488, kws=0xea400, kwcount=1, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2736 kwcount = 1 closure = (PyObject *) 0xec58e8 f = (PyFrameObject *) 0xec58e8 ---Type to continue, or q to quit--- retval = (PyObject *) 0x0 fastlocals = (PyObject **) 0xec5a34 freevars = (PyObject **) 0xec5a5c tstate = (PyThreadState *) 0x6af870 x = (PyObject *) 0x0 u = (PyObject *) 0x4 #31 0x884e4 in fast_function (func=0x3db330, pp_stack=0xfcf0d1f0, n=5, na=959488, nk=1) at Python/ceval.c:3656 co = (PyCodeObject *) 0xea000 globals = (PyObject *) 0x0 argdefs = (PyObject *) 0x12dc00 d = (PyObject **) 0x2a nd = 0 #32 0x8830c in call_function (pp_stack=0xfcf0d1f0, oparg=3) at Python/ceval.c:3584 na = 3 nk = 1 n = 5 pfunc = (PyObject **) 0xe98078 func = (PyObject *) 0x3db330 x = (PyObject *) 0xfcf0d1f0 w = (PyObject *) 0xfcf0d1f0 #33 0x8565c in PyEval_EvalFrame (f=0xe97f00) at Python/ceval.c:2163 sp = (PyObject **) 0xe9808c stack_pointer = (PyObject **) 0xe9808c next_instr = (unsigned char *) 0x3c87d7 "\001|" opcode = 131 oparg = 258 why = WHY_NOT err = 0 x = (PyObject *) 0x416260 v = (PyObject *) 0x416288 w = (PyObject *) 0x1738ac u = (PyObject *) 0xa t = (PyObject *) 0x102 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0xe9804c freevars = (PyObject **) 0xe98074 retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x3db120 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x3c86d4 "t" names = (PyObject *) 0x279be0 consts = (PyObject *) 0x2c3df0 #34 0x86b14 in PyEval_EvalCodeEx (co=0x3db120, globals=0x0, locals=0xe97f00, args=0xea400, argcount=959488, kws=0xea400, kwcount=1, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2736 kwcount = 1 closure = (PyObject *) 0xe97f00 f = (PyFrameObject *) 0xe97f00 retval = (PyObject *) 0x0 ---Type to continue, or q to quit--- fastlocals = (PyObject **) 0xe9804c freevars = (PyObject **) 0xe98074 tstate = (PyThreadState *) 0x6af870 x = (PyObject *) 0x0 u = (PyObject *) 0x4 #35 0x884e4 in fast_function (func=0x3db330, pp_stack=0xfcf0d440, n=5, na=959488, nk=1) at Python/ceval.c:3656 co = (PyCodeObject *) 0xea000 globals = (PyObject *) 0x0 argdefs = (PyObject *) 0x12dc00 d = (PyObject **) 0x2a nd = 0 #36 0x8830c in call_function (pp_stack=0xfcf0d440, oparg=3) at Python/ceval.c:3584 na = 3 nk = 1 n = 5 pfunc = (PyObject **) 0xeadd04 func = (PyObject *) 0x3db330 x = (PyObject *) 0xfcf0d440 w = (PyObject *) 0xfcf0d440 #37 0x8565c in PyEval_EvalFrame (f=0xeadba8) at Python/ceval.c:2163 sp = (PyObject **) 0xeadd18 stack_pointer = (PyObject **) 0xeadd18 next_instr = (unsigned char *) 0x3c4097 "\001|" opcode = 131 oparg = 258 why = WHY_NOT err = 0 x = (PyObject *) 0x40ec30 v = (PyObject *) 0x40ec30 w = (PyObject *) 0x1dae20 u = (PyObject *) 0x4 t = (PyObject *) 0x102 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0xeadcf4 freevars = (PyObject **) 0xeadd04 retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x2c3c60 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x3c3f3c "t" names = (PyObject *) 0x20ee40 consts = (PyObject *) 0x259bc0 #38 0x88458 in fast_function (func=0x2c3fb0, pp_stack=0x9e58b8, n=1, na=1, nk=7010416) at Python/ceval.c:3645 f = (PyFrameObject *) 0xeadba8 retval = (PyObject *) 0x2c3fb0 tstate = (PyThreadState *) 0x6af870 fastlocals = (PyObject **) 0x6af870 stack = (PyObject **) 0x9e58b8 ---Type to continue, or q to quit--- i = 1 co = (PyCodeObject *) 0x40ec30 globals = (PyObject *) 0x0 argdefs = (PyObject *) 0x0 d = (PyObject **) 0x2a nd = 0 #39 0x8830c in call_function (pp_stack=0xfcf0d608, oparg=1) at Python/ceval.c:3584 na = 1 nk = 0 n = 1 pfunc = (PyObject **) 0x9e58b4 func = (PyObject *) 0x2c3fb0 x = (PyObject *) 0xfcf0d608 w = (PyObject *) 0x9e58b8 #40 0x8565c in PyEval_EvalFrame (f=0x9e5758) at Python/ceval.c:2163 sp = (PyObject **) 0x9e58b8 stack_pointer = (PyObject **) 0x9e58b8 next_instr = (unsigned char *) 0x3c3d49 "\001qj" opcode = 131 oparg = 0 why = WHY_NOT err = 0 x = (PyObject *) 0x219c60 v = (PyObject *) 0x40ec30 w = (PyObject *) 0x2b02c8 u = (PyObject *) 0x4 t = (PyObject *) 0x0 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0x9e58a4 freevars = (PyObject **) 0x9e58b4 retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x2bece0 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x3c3ccc "|" names = (PyObject *) 0x3da300 consts = (PyObject *) 0x2c3630 #41 0x88458 in fast_function (func=0x2c3f30, pp_stack=0x2c7cf8, n=1, na=1, nk=7010416) at Python/ceval.c:3645 f = (PyFrameObject *) 0x9e5758 retval = (PyObject *) 0x2c3f30 tstate = (PyThreadState *) 0x6af870 fastlocals = (PyObject **) 0x6af870 stack = (PyObject **) 0x2c7cf8 i = 1 co = (PyCodeObject *) 0x40ec30 globals = (PyObject *) 0x0 argdefs = (PyObject *) 0x0 d = (PyObject **) 0x2a nd = 0 ---Type to continue, or q to quit--- #42 0x8830c in call_function (pp_stack=0xfcf0d7d0, oparg=1) at Python/ceval.c:3584 na = 1 nk = 0 n = 1 pfunc = (PyObject **) 0x2c7cf4 func = (PyObject *) 0x2c3f30 x = (PyObject *) 0xfcf0d7d0 w = (PyObject *) 0x2c7cf8 #43 0x8565c in PyEval_EvalFrame (f=0x2c7b98) at Python/ceval.c:2163 sp = (PyObject **) 0x2c7cf8 stack_pointer = (PyObject **) 0x2c7cf8 next_instr = (unsigned char *) 0x2cdb9f "\001Wn)\001\004t\021" opcode = 131 oparg = 0 why = WHY_NOT err = 0 x = (PyObject *) 0x1c7738 v = (PyObject *) 0x40ec30 w = (PyObject *) 0x1cd4c0 u = (PyObject *) 0x40ec30 t = (PyObject *) 0x0 stream = (PyObject *) 0x0 fastlocals = (PyObject **) 0x2c7ce4 freevars = (PyObject **) 0x2c7cf4 retval = (PyObject *) 0x0 tstate = (PyThreadState *) 0x6af870 co = (PyCodeObject *) 0x1cc8e0 instr_ub = -1 instr_lb = 0 instr_prev = -1 first_instr = (unsigned char *) 0x2cdaf4 "z?\001t" names = (PyObject *) 0x1378b8 consts = (PyObject *) 0x141e90 #44 0x86b14 in PyEval_EvalCodeEx (co=0x1cc8e0, globals=0x0, locals=0x2c7b98, args=0x415c5c, argcount=1, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2736 kwcount = 0 closure = (PyObject *) 0x2c7b98 f = (PyFrameObject *) 0x2c7b98 retval = (PyObject *) 0x0 fastlocals = (PyObject **) 0x2c7ce4 freevars = (PyObject **) 0x2c7cf4 tstate = (PyThreadState *) 0x6af870 x = (PyObject *) 0x0 u = (PyObject *) 0x4 #45 0xda520 in function_call (func=0x1d5c30, arg=0x415c50, kw=0x0) at Objects/funcobject.c:548 result = (PyObject *) 0x1d5c30 argdefs = (PyObject *) 0x0 d = (PyObject **) 0x0 k = (PyObject **) 0x0 nk = 0 nd = 0 #46 0x26028 in PyObject_Call (func=0x1d5c30, arg=0x415c50, kw=0x0) at Objects/abstract.c:1795 ---Type to continue, or q to quit--- result = (PyObject *) 0x1d5c30 call = 0xda3d8 #47 0x2e088 in instancemethod_call (func=0x1d5c30, arg=0x415c50, kw=0x0) at Objects/classobject.c:2447 self = (PyObject *) 0x40ec30 class = (PyObject *) 0x0 result = (PyObject *) 0x1d5c30 #48 0x26028 in PyObject_Call (func=0x1d5c30, arg=0x415c50, kw=0x0) at Objects/abstract.c:1795 result = (PyObject *) 0x1c75f8 call = 0x2de70 #49 0x8794c in PyEval_CallObjectWithKeywords (func=0x1c75f8, arg=0x12f030, kw=0x0) at Python/ceval.c:3430 result = (PyObject *) 0x1c75f8 #50 0xb7120 in t_bootstrap (boot_raw=0xdfd450) at ./Modules/threadmodule.c:434 tstate = (PyThreadState *) 0x6af870 res = (PyObject *) 0x12f030 (gdb) Best regards, Holger Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene Empf?nger sind oder falls diese E-Mail irrt?mlich an Sie adressiert wurde, verst?ndigen Sie bitte den Absender sofort und l?schen Sie die E-Mail sodann. Das unerlaubte Kopieren sowie die unbefugte ?bermittlung sind nicht gestattet. Die Sicherheit von ?bermittlungen per E-Mail kann nicht garantiert werden. Falls Sie eine Best?tigung w?nschen, fordern Sie bitte den Inhalt der E-Mail als Hardcopy an. The contents of this e-mail are confidential. If you are not the named addressee or if this transmission has been addressed to you in error, please notify the sender immediately and then delete this e-mail. Any unauthorized copying and transmission is forbidden. E-Mail transmission cannot be guaranteed to be secure. If verification is required, please request a hard copy version. From mike at it-loops.com Tue Jan 30 12:59:43 2007 From: mike at it-loops.com (mike at it-loops.com) Date: Tue, 30 Jan 2007 12:59:43 +0100 Subject: [lxml-dev] Validation against an external DTD Message-ID: Hello, I read through the documentation and I did not find a way to validate an XML-File against an external DTD with lxml. I searched the ML-archive and found several posts but I still do not know exactly, if this functionality is available or not. Right now I am using pyxml to do validation, but since the whole process will switch to xml schemes I am looking for a tool that can validate both (XSD,DTD). Is it possible to extend lxml to do this? I know that I can use a tool like "trang" to convert the DTDs but since there are DTDs that get added or removed from the process this means a lot of manual work. Kind regards, Michael From stefan_ml at behnel.de Wed Jan 31 11:49:34 2007 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 31 Jan 2007 11:49:34 +0100 Subject: [lxml-dev] Back again Message-ID: <45C0743E.6010907@behnel.de> Hi all, sorry for not being active on the list recently. It was for two reasons: First, I had lots of other things to do in the meantime and, second, I didn't notice my university had considered my official unregistration a good opportunity to delete my favourite mailing list e-mail address. So I didn't receive any mail from this (and other) lists since then - including a considerably lower amount of spam, BTW. I'll try to catch up with the list, though pipermail's charm doesn't really make this a pleasure. So, just in case there was anything important I missed, feel free to resend your original mail to me directly, so that I can answer more easily. Best regards, Stefan