Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python': 0.09; 'stringio': 0.09; 'resulting': 0.13; 'dec': 0.15; '(also': 0.16; '(note': 0.16; '-tkc': 0.16; '3.1.3': 0.16; 'cstringio': 0.16; 'csv': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; '>>>': 0.18; 'import': 0.21; 'header:User-Agent:1': 0.26; "i'm": 0.29; 'file': 0.32; 'getting': 0.33; 'to:addr:python-list': 0.33; 'something': 0.35; 'subject:with': 0.36; 'rather': 0.37; '2010,': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'more': 0.63; 'results': 0.65; 'miss': 0.75; 'received:50.22': 0.84; 'to:name:python': 0.84 Date: Thu, 19 Jul 2012 06:21:58 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: Python Subject: Odd csv column-name truncation with only one column Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342696862 news.xs4all.nl 6875 [2001:888:2000:d::a6]:46687 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25618 tim@laptop:~/tmp$ python Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import csv >>> from cStringIO import StringIO >>> s = StringIO('Email\nfoo@example.com\nbar@example.org\n') >>> s.seek(0) >>> d = csv.Sniffer().sniff(s.read()) >>> s.seek(0) >>> r = csv.DictReader(s, dialect=d) >>> r.fieldnames ['Emai', ''] I get the same results using Python 3.1.3 (also readily available on Debian Stable), as well as working directly on a file rather than a StringIO. Any reason I'm getting ['Emai', ''] (note the missing ell) instead of ['Email'] as my resulting fieldnames? Did I miss something in the docs? -tkc