[Tutor] parse text file

Colin Talbert talbertc at usgs.gov
Tue Jun 1 23:40:33 CEST 2010


        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?

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()






Colin Talbert
GIS Specialist
US Geological Survey - Fort Collins Science Center
2150 Centre Ave. Bldg. C
Fort Collins, CO 80526

(970) 226-9425
talbertc at usgs.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100601/89461276/attachment-0001.html>


More information about the Tutor mailing list