[Tutor] parse text file

bob gailer bgailer at gmail.com
Wed Jun 2 00:44:53 CEST 2010


On 6/1/2010 5:40 PM, Colin Talbert wrote:
>
>         I am also experiencing this same problem.  (Also on a OSM bz2 
> file).  It appears to be working but then partway through reading a 
> file it simple ends.  I did track down that file length is always 
> 900000 so it appears to be related to some sort of buffer constraint.
>
>
> Any other ideas?

How big is the file?

Is it necessary to read the entire thing at once?

Try opening with mode rb

>
> import bz2
>
> input_file = bz2.BZ2File(r"C:\temp\planet-latest.osm.bz2","r")
> try:
>     all_data = input_file.read()
>     print str(len(all_data))
> finally:
>     input_file.close()
>

-- 
Bob Gailer
919-636-4239
Chapel Hill NC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100601/559f9e79/attachment.html>


More information about the Tutor mailing list