[bug] Incorrect RequestError handling
Problem
When i try to perform some illegal update cell action (e.g. reformat table with freezed rows) the handling of gspread.exceptions.RequestError is done incorrectly: it is trying to access ex[0] rather thatn ex.args[0], what results in raising of TypeError rather than UpdateCellError
How to fix
replace ex[0] to ex.args[0] in all similar cases.
Environment info
Operating System: Windows 7, 64bit Python version: 3.6.0 64bit gspread version: 0.6.2
Steps to reproduce
- create a worksheet with freezed rows (view->freeze)
- ws.resize(rows=1, cols=1)
Stack trace or other output that would be helpful
c:\python36\lib\site-packages\gspread\client.py in put_feed(self, url, data)
219 r = self.session.put(url, data, headers=headers)
220 except RequestError as ex:
--> 221 if ex[0] == 403:
222 raise UpdateCellError(ex[1])
223 else:
TypeError: 'RequestError' object does not support indexing
In [2]:
same problem here
@vicproon Was it resolved?
Had the same bug today; code still attempts to access ex[0].
Same issue. Seems to be resolved in gspread-2.1.1.
@TheGreatKetchup thanks for the feedback. @vicproon can you check if the upgrade to the latest gspread version solves the issue for you?
I'm closing this issue due to inactivity. Feel free to reopen it if you have an update.