Project

General

Profile

« Previous | Next » 

Revision 1661

cat_csv: If dialect == None, ignore that file because it's empty

View differences:

cat_csv
22 22
        # Get dialect and process first line
23 23
        info = csvs.stream_info(stream)
24 24
        try:
25
            if info.dialect == None: continue # dialect of None = empty stream
26
            
25 27
            def write_header(): sys.stdout.write(info.header_line)
26 28
            if first_info == None:
27 29
                first_path = path
......
41 43
                sys.stdout.write(line)
42 44
        except IOError, e: # abort if output stream closed
43 45
            if str(e) != '[Errno 32] Broken pipe': raise # other IOErrors
44
        
45
        stream.close()
46
        finally: stream.close() # still run if continue is called
46 47

  
47 48
main()

Also available in: Unified diff