Ignore:
Timestamp:
Jan 15, 2007, 3:15:05 PM (18 years ago)
Author:
duncan
Message:

set max_read_lines to a large real when reading a csv file non blocking

Location:
anuga_core/source/anuga/geospatial_data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r4175 r4178  
    33
    44"""
    5 
     5from sys import maxint
    66from os import access, F_OK, R_OK
    77from types import DictType
     
    592592            msg = '.xya format is deprecated.  Please use .txt.'
    593593            warn(msg, DeprecationWarning)
    594             #import sys; sys.exit()
    595594            if absolute is True:         
    596595                _write_xya_file(file_name,
     
    843842    file_pointer = open(file_name)
    844843    header, file_pointer = _read_csv_file_header(file_pointer)
    845 
    846     while True:
    847         try:
    848             pointlist, att_dict,file_pointer  = _read_csv_file_blocking( \
     844    pointlist, att_dict,file_pointer  = _read_csv_file_blocking( \
    849845                file_pointer,
    850846                header,
    851                 max_read_lines=MAX_READ_LINES) #FIXME: must be highest int
    852         except StopIteration:
    853             break
     847                max_read_lines=1e30) #If the file is bigger that this, block..
    854848       
    855849    file_pointer.close()
     
    12931287         
    12941288if __name__ == "__main__":
    1295     g = Geospatial_data("t.txt")
    1296     print "g.get_data_points()", g.get_data_points()
    1297     for i,a in enumerate(g):
    1298         if i >3: break
    1299         print a
    1300    
     1289    pass
     1290   
  • anuga_core/source/anuga/geospatial_data/test_geospatial_data.py

    r4175 r4178  
    651651   
    652652    def test_load_csv(self):
    653         # To test the mesh side of loading xya files.
    654         # Not the loading of xya files
    655653       
    656654        import os
Note: See TracChangeset for help on using the changeset viewer.