[lxml-dev] Version 1.2.1 not working?
Robert Dailey
rcdailey at gmail.com
Wed Jul 11 23:21:04 CEST 2007
Roger,
Thank you for your reply. I wasn't aware that you could just pass in a
filename. From the examples on the website I've only seen strings passed in.
I suppose it might be worth my time to look at the API reference. The way I
installed lxml is through the binary distribution (installer for windows) on
the Cheese Shop. Unless the installer is broken, it should have installed
fine. There wasn't much user intervention during the installation process.
Thanks for your help. I'll try passing in the file and see what I get.
Thank you.
On 7/11/07, Roger Patterson <rogerpatterson at gmail.com> wrote:
>
> Hi Robert,
>
> Firstly, you don't need to read your XML file into a string and then
> convert it to a StringIO object. You can just feed the file handle to
> etree.parse().
> But other than that, your XML file parsed fine for me, and I'm using
> lxml 1.2.1
> You may want to make sure you've installed correctly.
> -Roger
>
> Robert Dailey wrote:
> > Hi,
> >
> > I have the following Python code:
> >
> >
> > from lxml import etree
> > from StringIO import StringIO
> >
> > def loadXMLFile( filename ):
> > f = open( filename, 'r' )
> > xmldata = f.read()
> > root = etree.parse( StringIO( xmldata ) )
> > f.close()
> > return root
> >
> >
> > Python either crashes or hangs at the etree.parse() call. Below is the
> > contents of the XML file I'm opening:
> >
> > <Page>
> > <Frame type="Root">
> >
> > <!-- Check idle time for attract mode -->
> > <OnIdleTime time="10000">
> > <StartAttractMode dispatch="GAME"/>
> > </OnIdleTime>
> >
> > <!-- Title Screen Image -->
> > <Frame type="Image" value="Interface/Titlescreen.spr">
> > <OnInput key="KEY_ACCEPT" require_focus="false">
> > <!--<GoToPage dispatch="GUI" page="LeaderboardMenu"/>-->
> > <GoToPage dispatch="GUI" page="MainMenu"/>
> > <PlaySound dispatch="GAME" file="InterfaceSchwing"/>
> > </OnInput>
> > </Frame>
> >
> > </Frame>
> > </Page>
> >
> > Anyone know why it isn't working? Thanks!
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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/20070711/811ee121/attachment.htm
More information about the lxml-dev
mailing list