Replace condition with an exception (code more robust) and add comment the reason

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26450 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2008-09-18 18:21:41 +00:00
parent 805d18d818
commit 7a7eede980

View File

@ -149,9 +149,12 @@ else:
dialect = guesser.sniff(input_file)
reader = csv.reader(open(infile, "rb"), dialect = dialect)
except:
if dialect:
# older versions (python < 2.5) of csv have problems (bugs)
# that is why we try harder to get a result, this should work on most cases
# as it assumes that the separator is a comma (the c in csv :-) )
try:
reader = csv.reader(open(infile, "rb"), dialect = dialect, delimiter = ',')
else:
except:
reader = csv.reader(open(infile, "rb"), delimiter = ',')
# read input