- changed status to resolved
typical usage includes header after calling .next()
Issue #45
resolved
The documentation shows the following for 'typical usage':
with SavReader('someFile.sav', returnHeader=True) as reader:
header = reader.next()
for line in reader:
process(line)
Is the expectation when doing the above that the first line passed into the process()
function will be the header line, or the first line of data? I have a test using code that follows this pattern which expected each line of data (excluding the header) after the header had been initially plucked. It had passed previous to the current release, so I wanted to verify that's the expected behavior before I change the test.
Comments (2)
-
repo owner -
repo owner You're right, this is a bug. The first line passed into the
process()
function should be case data, not the header. I removed it from the docs (but not the docstrings) so less people get confused.Work-around:
with SavReader('someFile.sav') as reader: header = reader.header # reader.varNames always returns the entire header, ie. does not care about 'selectVars` for line in reader: process(line) Btw, for small-ish files, `reader.all()` is nice too:
with SavReader('someFile.sav') as reader: header = reader.header records = reader.all()
- Log in to comment
fixed issue
#45, returnHeader now working properly again→ <<cset ac055eb55114>>