From smith_roy at emc.com Sun Jan 4 16:27:01 2009 From: smith_roy at emc.com (Roy Smith) Date: Sun, 4 Jan 2009 10:27:01 -0500 Subject: [XML-SIG] Can't build PyXML-0.8.4 on RedHat AS-4 Message-ID: <362CB6FC-D662-450A-9FFB-D046576D0136@emc.com> I'm trying to build PyXML-0.8.4 on a RedHat AS-4 box. $ /usr/bin/python -V Python 2.3.4 $ cat /etc/redhat-release Red Hat Enterprise Linux AS release 4 (Nahant Update 7) $ uname -a Linux korz 2.6.9-78.0.1.ELsmp #1 SMP Tue Jul 22 18:01:05 EDT 2008 x86_64 unknown $ gcc --version gcc (GCC) 3.4.3 When I run "/usr/bin/python setup.py build", it hums along for a while, and then I get: creating build/temp.linux-x86_64-2.3/extensions/expat/lib gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m64 - D_GNU_SOURCE -fPIC -fPIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 - DXML_CONTEXT_BYTES=1024 -DHAVE_MEMMOVE=1 -Iextensions/expat/lib -I/usr/ include/python2.3 -c extensions/expat/lib/xmltok.c -o build/temp.linux- x86_64-2.3/extensions/expat/lib/xmltok.o extensions/expat/lib/xmltok.c:1: sorry, unimplemented: 64-bit mode not compiled in error: command 'gcc' failed with exit status 1 ------------------- Roy Smith Software Guy, EMC 1133 Westchester Ave, 3rd floor White Plains, NY 10604 +1 914 461 3597 AIM: roysmith649 -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidgshi at yahoo.co.uk Tue Jan 6 16:16:37 2009 From: davidgshi at yahoo.co.uk (David Shi) Date: Tue, 6 Jan 2009 15:16:37 +0000 (GMT) Subject: [XML-SIG] Recipe 534109: XML to Python data structure Message-ID: <52116.52780.qm@web26302.mail.ukl.yahoo.com> Has anyone tried this recipe? ? I am looking for a Python script to do the following. ? 1.?Read in an xml 2.?Turn xml into a Python data array, to be ready to be further manipulated and saved into a .dbf file. ? I wonder how to use the following recipe. http://code.activestate.com/recipes/534109/ ? Regards. ? David --- On Thu, 18/12/08, David Shi wrote: From: David Shi Subject: Looking for a generic efficient script for reading xml containing CDATA, extracting data for ready to be stored in a .dbf file To: XML-SIG at python.org Date: Thursday, 18 December, 2008, 6:27 PM Looking for a generic efficient script for reading xml containing CDATA, extracting data for ready to be stored in a .dbf file ? Can anyone help? ? Regards. ? David -------------- next part -------------- An HTML attachment was scrubbed... URL: From morillas at gmail.com Tue Jan 6 17:46:39 2009 From: morillas at gmail.com (Luis Miguel Morillas) Date: Tue, 6 Jan 2009 17:46:39 +0100 Subject: [XML-SIG] Recipe 534109: XML to Python data structure In-Reply-To: <52116.52780.qm@web26302.mail.ukl.yahoo.com> References: <52116.52780.qm@web26302.mail.ukl.yahoo.com> Message-ID: <68d25cbc0901060846o15613141l6f4a80b93d7fab03@mail.gmail.com> Do you know amara? Try amara: http://wiki.xml3k.org/Amara We're working now on amara 2 (http://wiki.xml3k.org/Amara2) But it's not yet in production. Saludos, -- Luis Miguel 2009/1/6 David Shi : > Has anyone tried this recipe? > > I am looking for a Python script to do the following. > > 1. Read in an xml > 2. Turn xml into a Python data array, to be ready to be further manipulated > and saved into a .dbf file. > > I wonder how to use the following recipe. > http://code.activestate.com/recipes/534109/ > > Regards. > > David > > --- On Thu, 18/12/08, David Shi wrote: > > From: David Shi > Subject: Looking for a generic efficient script for reading xml containing > CDATA, extracting data for ready to be stored in a .dbf file > To: XML-SIG at python.org > Date: Thursday, 18 December, 2008, 6:27 PM > > Looking for a generic efficient script for reading xml containing CDATA, > extracting data for ready to be stored in a .dbf file > > Can anyone help? > > Regards. > > David > > > _______________________________________________ > XML-SIG maillist - XML-SIG at python.org > http://mail.python.org/mailman/listinfo/xml-sig > > From stefan_ml at behnel.de Tue Jan 6 18:44:02 2009 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 06 Jan 2009 18:44:02 +0100 Subject: [XML-SIG] Recipe 534109: XML to Python data structure In-Reply-To: <52116.52780.qm@web26302.mail.ukl.yahoo.com> References: <52116.52780.qm@web26302.mail.ukl.yahoo.com> Message-ID: <49639862.6020206@behnel.de> David Shi wrote: > I am looking for a Python script to do the following. > > 1. Read in an xml > 2. Turn xml into a Python data array, to be ready to be further manipulated and saved into a .dbf file. Did you read my reply to your last post? Stefan From stefan_ml at behnel.de Wed Jan 7 13:42:21 2009 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 7 Jan 2009 13:42:21 +0100 (CET) Subject: [XML-SIG] Recipe 534109: XML to Python data structure In-Reply-To: <503140.67367.qm@web26306.mail.ukl.yahoo.com> References: <503140.67367.qm@web26306.mail.ukl.yahoo.com> Message-ID: <64410.213.61.181.86.1231332141.squirrel@groupware.dvs.informatik.tu-darmstadt.de> David Shi wrote: > What I am trying to do is to have a generic script to turn xml to Python > dataset. Then I can manipulate it as required. Then I can save > processed data into a .dbf file. I'd use iterparse() for the parsing, that allows you to construct the .dbf content on the fly. http://codespeak.net/lxml/parsing.html#iterparse-and-iterwalk Working with the data elements returned by the iterparse iterator is quite easy, you'll be fine with using the properties .tag and .text, as well as the .find() method to find subelements. http://codespeak.net/lxml/tutorial.html#the-element-class If you can afford to load the entire XML tree into memory, you can also try lxml.objectify, which will give you a Python-like interface to the data. http://codespeak.net/lxml/objectify.html Note that the lxml.objectify in-memory tree is most likely a lot more memory friendly (and the parsing is definitely faster) than what the recipe gives you. Stefan From stefan_ml at behnel.de Wed Jan 7 14:48:00 2009 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 7 Jan 2009 14:48:00 +0100 (CET) Subject: [XML-SIG] Recipe 534109: XML to Python data structure In-Reply-To: <846317.31192.qm@web26303.mail.ukl.yahoo.com> References: <846317.31192.qm@web26303.mail.ukl.yahoo.com> Message-ID: <35870.213.61.181.86.1231336080.squirrel@groupware.dvs.informatik.tu-darmstadt.de> It seems that apart from top-posting, you forgot to reply to the list. David Shi wrote: > lxml looks interesting to me as it deals with CDATA. > > Where is the step by step guide to use lxml to do what I need to do, as > per my previous email. I do not know any step-by-step guide that describes how to convert an XML format to .dbf. I guess you'll have to figure out the mapping code yourself to a certain extent. I gave you quite a number of references including some tutorials and a link to a library that handles the dbf format. If you want someone else to write the program for you for free, you should say so. Stefan > --- On Wed, 7/1/09, Stefan Behnel wrote: > > From: Stefan Behnel > Subject: Re: [XML-SIG] Recipe 534109: XML to Python data structure > To: "David Shi" > Cc: xml-sig at python.org > Date: Wednesday, 7 January, 2009, 12:42 PM > > David Shi wrote: >> What I am trying to do is to have a generic script to turn xml to Python >> dataset. Then I can manipulate it as required. Then I can save >> processed data into a .dbf file. > > I'd use iterparse() for the parsing, that allows you to construct the .dbf > content on the fly. > > http://codespeak.net/lxml/parsing.html#iterparse-and-iterwalk > > Working with the data elements returned by the iterparse iterator is quite > easy, you'll be fine with using the properties .tag and .text, as well as > the .find() method to find subelements. > > http://codespeak.net/lxml/tutorial.html#the-element-class > > If you can afford to load the entire XML tree into memory, you can also > try lxml.objectify, which will give you a Python-like interface to the > data. > > http://codespeak.net/lxml/objectify.html > > Note that the lxml.objectify in-memory tree is most likely a lot more > memory friendly (and the parsing is definitely faster) than what the > recipe gives you. > > Stefan From davidgshi at yahoo.co.uk Wed Jan 7 17:07:23 2009 From: davidgshi at yahoo.co.uk (David Shi) Date: Wed, 7 Jan 2009 16:07:23 +0000 (GMT) Subject: [XML-SIG] Looking for step by step guide to put lxml in place Message-ID: <253527.85995.qm@web26307.mail.ukl.yahoo.com> I am looking for step by step guide to put lxml in place.?? I need to try it to extract data from xml, manipulate it and save it in .dbf file. ? Thank you in advance for help. ? Regards. ? David -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan_ml at behnel.de Wed Jan 7 17:33:32 2009 From: stefan_ml at behnel.de (Stefan Behnel) Date: Wed, 7 Jan 2009 17:33:32 +0100 (CET) Subject: [XML-SIG] Looking for step by step guide to put lxml in place In-Reply-To: <253527.85995.qm@web26307.mail.ukl.yahoo.com> References: <253527.85995.qm@web26307.mail.ukl.yahoo.com> Message-ID: <36047.213.61.181.86.1231346012.squirrel@groupware.dvs.informatik.tu-darmstadt.de> David Shi wrote: > I am looking for step by step guide to put lxml in place. If by "put in place" you mean "install", how about the installation guide provided by lxml's web site: http://codespeak.net/lxml/installation.html Any further help would require some more information from your side, such as the operating system you use, which Python version, etc. BTW, the comp.lang.python newsgroup has a lot more readers than the xml-sig list and therefore often provides better help for newbees. This might make an interesting read: http://catb.org/esr/faqs/smart-questions.html Stefan From martin at v.loewis.de Wed Jan 7 23:55:24 2009 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Wed, 07 Jan 2009 23:55:24 +0100 Subject: [XML-SIG] Can't build PyXML-0.8.4 on RedHat AS-4 In-Reply-To: <362CB6FC-D662-450A-9FFB-D046576D0136@emc.com> References: <362CB6FC-D662-450A-9FFB-D046576D0136@emc.com> Message-ID: <496532DC.2030609@v.loewis.de> > extensions/expat/lib/xmltok.c:1: sorry, unimplemented: 64-bit mode not > compiled in > error: command 'gcc' failed with exit status 1 That's a problem with your gcc installation. It doesn't support the -m64 option. You need to invoke the 64-bit compiler, or build for a 32-bit Python. Regards, Martin From jan-mewes at web.de Tue Jan 13 09:22:27 2009 From: jan-mewes at web.de (Jan Mewes) Date: Tue, 13 Jan 2009 00:22:27 -0800 (PST) Subject: [XML-SIG] lxml and py2exe Message-ID: <5ae4967e-ef58-4326-9796-d930094efc4d@n2g2000vbl.googlegroups.com> Hi, I've a problem with lxml in an .exe file from py2exe. This is the error message: Traceback (most recent call last): File "PyQuizzer.py", line 3, in File "zipextimporter.pyc", line 82, in load_module File "questions.pyc", line 2, in File "zipextimporter.pyc", line 98, in load_module File "lxml.etree.pyx", line 47, in lxml.etree (src/lxml/lxml.etree.c: 124316) ImportError: No module named _elementpath I've tryed to build a minimal file but it doen't cause this problem. but there is no error-message. It simply closes the console. I've found a similar problem in the archives of lxml-dev but I don't understand the solution. http://codespeak.net/pipermail/lxml-dev/2007-August/002909.html Would you be so kind to explain it to me, if you 've got it? Thanks in advance! Jan From stefan_ml at behnel.de Tue Jan 13 11:33:57 2009 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 13 Jan 2009 11:33:57 +0100 (CET) Subject: [XML-SIG] lxml and py2exe In-Reply-To: <5ae4967e-ef58-4326-9796-d930094efc4d@n2g2000vbl.googlegroups.com> References: <5ae4967e-ef58-4326-9796-d930094efc4d@n2g2000vbl.googlegroups.com> Message-ID: <57904.213.61.181.86.1231842837.squirrel@groupware.dvs.informatik.tu-darmstadt.de> Hi, the best place to ask this would have been comp.lang.python or the (presumably existing) py2exe mailing list. Jan Mewes wrote: > I've a problem with lxml in an .exe file from py2exe. This is the > error message: > > Traceback (most recent call last): > File "PyQuizzer.py", line 3, in > File "zipextimporter.pyc", line 82, in load_module > File "questions.pyc", line 2, in > File "zipextimporter.pyc", line 98, in load_module > File "lxml.etree.pyx", line 47, in lxml.etree (src/lxml/lxml.etree.c: > 124316) > ImportError: No module named _elementpath I never used py2exe, but reading the post you referenced, I'd say the problem is that _elementpath is imported from C code, so py2exe can't see that it's used. Passing packages : ['lxml'] to py2exe should solve this. It will stuff more modules into the executable than required, but it will also make sure nothing that *is* required will get lost. Stefan From andrewdied at gmail.com Sat Jan 17 20:51:19 2009 From: andrewdied at gmail.com (Andrew Diederich) Date: Sat, 17 Jan 2009 12:51:19 -0700 Subject: [XML-SIG] Status of elementtree? Message-ID: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> Does anyone know how the status of elementtree is coming along? According to the website (http://effbot.org/zone/element-index.htm) 1.3 has been in alpha for a year and a half. I like that elementtree is in the standard python library, and I don't want it to end up like PyXML. -- Andrew Diederich From martin at v.loewis.de Sat Jan 17 21:23:40 2009 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat, 17 Jan 2009 21:23:40 +0100 Subject: [XML-SIG] Status of elementtree? In-Reply-To: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> References: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> Message-ID: <49723E4C.1080006@v.loewis.de> > Does anyone know how the status of elementtree is coming along? > According to the website (http://effbot.org/zone/element-index.htm) > 1.3 has been in alpha for a year and a half. I like that elementtree > is in the standard python library, and I don't want it to end up like > PyXML. Well, elementtree is a single-person project. So you better ask Fredrik Lundh - nobody else will be able to provide you with a meaningful answer. Regards, Martin From andrewdied at gmail.com Sun Jan 18 03:10:54 2009 From: andrewdied at gmail.com (Andrew Diederich) Date: Sat, 17 Jan 2009 19:10:54 -0700 Subject: [XML-SIG] Status of elementtree? In-Reply-To: <49723E4C.1080006@v.loewis.de> References: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> <49723E4C.1080006@v.loewis.de> Message-ID: <95b785820901171810v203d2b28j4b238cf062aba95d@mail.gmail.com> On Sat, Jan 17, 2009 at 1:23 PM, "Martin v. L?wis" wrote: > Well, elementtree is a single-person project. So you better ask > Fredrik Lundh - nobody else will be able to provide you with > a meaningful answer. Sure, but it's also part of the python standard library, and this is the XML-SIG list. The chance is high someone here will know, and then google will know the answer, too. One of the problems we've had in the XML-SIG arena is people don't know which libraries to use. PyXML is still referred to as the standard in many places, even though it's no longer in development. lxml is still in development, but it's not in the standard library, and uses elementtree's style as a base. It's confusing, and the more information we have describing the current situation, the better off we'll be. Anyway, that's why I asked here, rather than going straight to Lundh. -- Andrew Diederich From stefan_ml at behnel.de Sun Jan 18 22:36:47 2009 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 18 Jan 2009 22:36:47 +0100 Subject: [XML-SIG] Status of elementtree? In-Reply-To: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> References: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> Message-ID: <4973A0EF.10500@behnel.de> Hi, Andrew Diederich wrote: > Does anyone know how the status of elementtree is coming along? > According to the website (http://effbot.org/zone/element-index.htm) > 1.3 has been in alpha for a year and a half. I like that elementtree > is in the standard python library, and I don't want it to end up like > PyXML. Note that ElementTree 1.2.x is a very mature piece of software. If there's no new release for years, that doesn't mean it's abandoned. ET 1.3 is intended to fix API problems that older ET versions have aggregated, very much in the way Py3 is intended to clean up the Python language. So it's not meant as a bug fix, it's meant as a new thing that breaks code. I think the main problem it currently has is that it fixes so few things that it'd be hard to convince people to change their code to support it. I expect that (plus the usual lack of time) to be the main reason why Fredrik didn't finish it up yet. If he had more feedback about it by users, he'd probably get around to pull another release. But as long as there's no clear interest in following that path, I wouldn't expect 1.3 final any time soon. Stefan From andrewdied at gmail.com Mon Jan 19 02:57:11 2009 From: andrewdied at gmail.com (Andrew Diederich) Date: Sun, 18 Jan 2009 18:57:11 -0700 Subject: [XML-SIG] Status of elementtree? In-Reply-To: <4973A0EF.10500@behnel.de> References: <95b785820901171151p13c06eceu19612dce10af83ed@mail.gmail.com> <4973A0EF.10500@behnel.de> Message-ID: <95b785820901181757u4425f41fp4f7b085d05632a7@mail.gmail.com> On Sun, Jan 18, 2009 at 2:36 PM, Stefan Behnel wrote: > > Note that ElementTree 1.2.x is a very mature piece of software. If there's > no new release for years, that doesn't mean it's abandoned. Good feedback. > ET 1.3 is intended to fix API problems that older ET versions have > aggregated, very much in the way Py3 is intended to clean up the Python > language. So it's not meant as a bug fix, it's meant as a new thing that > breaks code. I think the main problem it currently has is that it fixes so > few things that it'd be hard to convince people to change their code to > support it. I expect that (plus the usual lack of time) to be the main > reason why Fredrik didn't finish it up yet. If he had more feedback about > it by users, he'd probably get around to pull another release. But as long > as there's no clear interest in following that path, I wouldn't expect 1.3 > final any time soon. That's exactly what I needed to know. So as I'm looking at XML libraries to use, ElementTree is a good place to start, since it'll be around. And if I need something a little more, lxml may be a good migration path since it's similar, but has dependencies. Thanks for the help. -- Andrew Diederich