We can't tell - we have no idea where in your code the error is occuring.
So start with the error message - it will tell you the file in which the error occurred and the line number it was found on. Most text / code editors use CTRL+G to go directly to a line number so it should be easy to find.
The use the python debugger to look at your code while it is running: pdb — The Python Debugger — Python 3.11.4 documentation
Put a breakpoint on the line that you found gives the error, and look at all the variables involved.
Sorry, but we can't do that for you!