Project

General

Profile

« Previous | Next » 

Revision 9961

lib/csvs.py: sniff(): support single-column spreadsheets by defaulting to the Excel dialect when the delimiter can't be determined

View differences:

csvs.py
21 21
def sniff(line):
22 22
    '''Automatically detects the dialect'''
23 23
    line, ending = strings.extract_line_ending(line)
24
    dialect = csv.Sniffer().sniff(line, delims)
24
    try: dialect = csv.Sniffer().sniff(line, delims)
25
    except _csv.Error, e:
26
        if exc.e_msg(e) == 'Could not determine delimiter': dialect = csv.excel
27
        else: raise
25 28
    
26 29
    if is_tsv(dialect):
27 30
        dialect.quoting = csv.QUOTE_NONE

Also available in: Unified diff