mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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:
parent
805d18d818
commit
7a7eede980
@ -149,9 +149,12 @@ else:
|
|||||||
dialect = guesser.sniff(input_file)
|
dialect = guesser.sniff(input_file)
|
||||||
reader = csv.reader(open(infile, "rb"), dialect = dialect)
|
reader = csv.reader(open(infile, "rb"), dialect = dialect)
|
||||||
except:
|
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 = ',')
|
reader = csv.reader(open(infile, "rb"), dialect = dialect, delimiter = ',')
|
||||||
else:
|
except:
|
||||||
reader = csv.reader(open(infile, "rb"), delimiter = ',')
|
reader = csv.reader(open(infile, "rb"), delimiter = ',')
|
||||||
|
|
||||||
# read input
|
# read input
|
||||||
|
Loading…
Reference in New Issue
Block a user