Minor nitpick: this way of setting strings will indent the output in a weird way. There are several ways to avoid this, my favourite being:

    raise ValueError("lineoffsets and positions are unequal sized "
                     "sequences.")