Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Can you please provide a *simple* and *complete* demonstration, including the 
*full* traceback? As given, we cannot run the supplied code and don't know what 
the contents of the csv file are supposed to be.

See here for more detail: http://www.sscce.org/

But my *guess*, on reading this, is that the line 

    header = fin.readline()

causes the difference. In the first sample, you skip past the first line of the 
csv file, and so when the dictreader reads the rest of the file, it never sees 
the first row. But in the second example, it does see the first row.

What happens if you change the first example to this?

        header = fin.readline()
        print('Found ' + header)
        fin.seek(0)
        reader = csv.DictReader(fin)

Does that solve your problem?

Likewise, in the second case, if you change it to this:

    open_f = open(filename, 'r', encoding='utf-8')
    __ = open_f.readline()
    read_it = csv.DictReader(open_f)


what happens?

----------
components: +Library (Lib) -Build
nosy: +steven.daprano
type: crash -> behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35626>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to