Getting rows with values only in read only mode stopped working with release 3.0.1

Issue #1367 resolved
Alex Betis created an issue

We use values attribute on a read only worksheet to get rows with values only.

3.0.1 has introduced this change in the code at line 118 of worksheet/_read_only.py:

new_row[idx] = values_only and cell['value'] or ReadOnlyCell(self, **cell)

📢 In case the cell value is None (because it’s empty), this returns incorrectly a ReadOnlyCell object.

This creates chaos when looking for or checking the empty value of a cell in the values_only row. All this fails:

# If the cell is empty, this fails, saying 'NoneType' object has no attribute 'value'
row[2] == None

# This will work, but it will NOT work if the cell is not empty
row[2].value == None

The exception is raised from cell/read_only.py line 26. It is because the overloaded eq operator should not be called

This makes the library unusable in version 3.0.1. We have forced our tool to stay at 3.0.0.

Comments (4)

  1. CharlieC

    Oops, sorry about that. No tests failed so I assumed it was all good. 😕 Will look into pushing a fix fairly shortly.

  2. CharlieC

    I think this is now fixed but strangely working with a sample file wasn’t a problem. Would be great if you could test and let me know that the behaviour is as expected.

  3. Log in to comment