New submission from Cal Leeming <cal.leem...@simplicitymedialtd.co.uk>:
Getting some extremely strange behavior when attempting to parse a fairly standard CSV in Python 2.6.6. I've tried a whole different mixture of dialects, quoting options, line terminators etc, and none seem to get a happy ending. Spent about 2 hours banging my head against a brick wall on this, and struggling to see how the CSV libs could be so fundamentally broken, given that I couldn't find any other related bugs. I have attempted to parse the following CSV data: "First","Middle","Last","Nickname","Email","Category" "Moe","","Howard","Moe","m...@3stooges.com","actor" "Jerome","Lester","Howard","Curly","cu...@3stooges.com","actor" "Larry","","Fine","Larry","la...@3stooges.com","musician" "Jerome","","Besser","Joe","j...@3stooges.com","actor" "Joe","","DeRita","CurlyJoe","curly...@3stooges.com","actor" "Shemp","","Howard","Shemp","sh...@3stooges.com","actor" The code used to parse was this: datx = open("data.txt", "rb").read() rows = csv.reader( datx , dialect="wat") for row in rows: print x The output given is this: ['First'] ['', ''] ['Middle'] ['', ''] ['Last'] ['', ''] ['Nickname'] ['', ''] ['Email'] ['', ''] ['Category'] [] ['Moe'] ['', ''] [''] ['', ''] ['Howard'] ['', ''] ['Moe'] ['', ''] ['m...@3stooges.com'] ['', ''] ['actor'] [] ['Jerome'] ['', ''] ['Lester'] ['', ''] ['Howard'] ['', ''] ['Curly'] ['', ''] ['cu...@3stooges.com'] ['', ''] ['actor'] [] ['Larry'] ['', ''] [''] ['', ''] ['Fine'] ['', ''] ['Larry'] ['', ''] ['la...@3stooges.com'] ['', ''] ['musician'] [] ['Jerome'] ['', ''] [''] ['', ''] ['Besser'] ['', ''] ['Joe'] ['', ''] ['j...@3stooges.com'] ['', ''] ['actor'] [] ['Joe'] ['', ''] [''] ['', ''] ['DeRita'] ['', ''] ['CurlyJoe'] ['', ''] ['curly...@3stooges.com'] ['', ''] ['actor'] [] ['Shemp'] ['', ''] [''] ['', ''] ['Howard'] ['', ''] ['Shemp'] ['', ''] ['sh...@3stooges.com'] ['', ''] ['actor'] [] ---------- components: None messages: 165938 nosy: sleepycal priority: normal severity: normal status: open title: CSV parser fails to iterate properly on 2.6.6 versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15407> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com