I don't know your use cases. But you may got this error when your tuple don't have any value. For an Example.
>>>x = ()
>>>y = x
IndexError Traceback (most recent call last)
<ipython-input-3-5679abac6acb> in <module>
1 x = ()
----> 2 y = x
IndexError: tuple index out of range
Here I am trying to assign an empty tuple to y. So I am getting this error. But You can avoid this error using if else condition.
Hope this will help you.