diff --git a/src/icartt/dataset.py b/src/icartt/dataset.py index 5e7f023b0b20a70aa69c943798551db83b42e09d..b1241657ade224502987a4ec4b9007260134155e 100644 --- a/src/icartt/dataset.py +++ b/src/icartt/dataset.py @@ -189,13 +189,13 @@ class StandardNormalComments(collections.UserList): @property def nlines(self): """calculates the number of lines in the normal comments section""" - n = 1 # shortnames line - n += len(self.freeform) # freeform comment + # shortnames line is always there: + n = 1 + # freeform comment might or might not be there: + n += sum(len(s.split('\n')) for s in self.freeform) + # tagged comments have at least one line: for k in self.keywords.values(): - try: - n += len(k.data[0].split("\n")) # and keywords might be multiline... - except IndexError: # ok we have no list, - n += 1 # just add 1 + n += sum(len(s.split('\n')) for s in k.data) or 1 return n @property