nonblocking read of one xml element?

mh at pixar.com mh at pixar.com
Tue Feb 5 07:09:11 CET 2008


So, I'm parsing a log file that's being written out in
real time.

<logfile>
<entry><timestamp>123</timestamp><details>foo</details>
</entry>
<entry><timestamp>456</timestamp><details>bar</details>
</entry>
             <--- no </logfile>, coz the file hasn't yet been closed

This is part of an event loop, so I want to have some code
that looks like this:

    when logfile is readable:
        read one <entry> node, including children
        but don't try to read past </entry>, so that
        the read won't block.

Any clues greatly appreciated,
Many TIA!
Mark

-- 
Mark Harrison
Pixar Animation Studios



More information about the Python-list mailing list