[issue10515] csv sniffer does not recognize quotes at the end of line

2022-03-01 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> csv.Sniffer.sniff() regex error ___ Python tracker

[issue10515] csv sniffer does not recognize quotes at the end of line

2019-03-15 Thread Mark Lawrence
Change by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue10515] csv sniffer does not recognize quotes at the end of line

2015-02-24 Thread Mark Lawrence
Mark Lawrence added the comment: @David could you check Skip's patch out please. It seems identical to your own other than changing the delimiter from the empty string to a comma. -- nosy: +BreamoreBoy ___ Python tracker

[issue10515] csv sniffer does not recognize quotes at the end of line

2011-03-19 Thread Skip Montanaro
Changes by Skip Montanaro : -- assignee: skip.montanaro -> nosy: -skip.montanaro ___ Python tracker ___ ___ Python-bugs-list mailing

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-19 Thread Skip Montanaro
Skip Montanaro added the comment: Here's my candidate patch. Instead of returning an empty string as the delimiter it returns a comma. -- Added file: http://bugs.python.org/file20111/csv_delimiter_tests.patch ___ Python tracker

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-19 Thread Skip Montanaro
Skip Montanaro added the comment: Also, this comment in test_csv.py puzzles me: # given that all three lines in sample3 are equal, # I think that any character could have been 'guessed' as the # delimiter, depending on dictionary order As a human looking at sample3 it's

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-19 Thread R. David Murray
R. David Murray added the comment: I agree that the unquoted single column cases look weird. But changing it could affect other cases were there is more data. I'll leave that problem to you :) But I do not think that should be backported. The locals trick I stole from Barry. I think there o

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-19 Thread Skip Montanaro
Skip Montanaro added the comment: I get two failures with David's latest patch. Abstracting from a lightly modified patch: sample was: 'a,b,"c,d"\r\ne,f,g', got: '', expected: ',' sample was: '"a,b,c,d"\r\ne', got: '\r', expected: '' In both cases I think the expected delimiter should

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-16 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> skip.montanaro ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-14 Thread Martin Budaj
Martin Budaj added the comment: > What do you mean by "there is a test for this case in csv.py"? I meant test in regex on line 217 in python 2.7 and the following code (line 258ff): # there is *no* delimiter, it's a single column of quoted data delim = '' skipinitialspace = 0 However, it i

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-11 Thread R. David Murray
R. David Murray added the comment: Yeah, obviously wrong. I forgot to finish editing the comment. I think a fallback of ',' makes more sense than ''. What would a delimiter of nothing mean? I don't think the unquoted case can be changed for backward compatibility reasons, so those tests I

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-11 Thread Skip Montanaro
Skip Montanaro added the comment: >From the comment in the test_csv.py: +# XXX: I don't know what the correct behavior should be for these. +# Currently the first one raises an error that the delimiter can't +# be determined while the second one returns '\r'. The second

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-10 Thread R. David Murray
R. David Murray added the comment: Forgot to attach the patch. -- Added file: http://bugs.python.org/file20006/csv_delimiter_tests.patch ___ Python tracker ___ _

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-10 Thread R. David Murray
R. David Murray added the comment: What do you mean by "there is a test for this case in csv.py"? If I run sniffer against "abcde\ndefgh\n" I get a delimiter of 'e'. If I run it against 'a\nb\n', I get the could not determine delimiter error. Attached is a reformulated test case that lets u

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-04 Thread Martin Budaj
Martin Budaj added the comment: I'm not sure about what the intended behavior for testAl should be, however I think that the file should be recognized as having one column of data and no delimiter (there is a test for this case in csv.py) and not raise an exception. I attach patch for test_cs

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-12-02 Thread R. David Murray
R. David Murray added the comment: Are you sure testA1 is correct? It seems to me that in that case the sniffer can indeed not determine the delimiter, but I don't really understand the guessing algorithm. The existing behavior on unquoted strings is...interesting :) Also if you are willin

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-24 Thread Ned Deily
Ned Deily added the comment: (Thanks. I've unpacked and uploaded the three files from your tar file.) -- stage: unit test needed -> patch review Added file: http://bugs.python.org/file19803/p2.patch ___ Python tracker

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-24 Thread Ned Deily
Changes by Ned Deily : -- keywords: +patch Added file: http://bugs.python.org/file19802/p1.patch ___ Python tracker ___ ___ Python-bug

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-24 Thread Ned Deily
Changes by Ned Deily : Added file: http://bugs.python.org/file19800/test.py ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-24 Thread Martin Budaj
Martin Budaj added the comment: Units test and two patches for 2.7 are included. p1.patch fixes testEnd case reported yesterday After running unittest it seems that also other case is broken (testAl -- if there is just one data item on the line, enclosed in quotes). Patch p2 fixes it, but sh

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-23 Thread Andrew McNamara
Changes by Andrew McNamara : -- nosy: +andrewmcnamara ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-23 Thread Ned Deily
Ned Deily added the comment: Thanks for the report. It would be helpful if you could supply a patch including a unit test for this against 3.2 and/or 2.7. Note only security issues are accepted for 2.6. -- nosy: +ned.deily stage: -> unit test needed versions: +Python 3.2 -Python 2.6

[issue10515] csv sniffer does not recognize quotes at the end of line

2010-11-23 Thread Martin Budaj
New submission from Martin Budaj : The method Sniffer._guess_quote_and_delimiter() in the module csv.py contains a bug in a regexp which checks for quotes around the last item of the line (example: a,b,"c,d"\n). the pattern '(?P>[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?:$|\n)' used in the rege