The cursor is valid only in the with block.
When I came out of the with block, cursor.close() was done automatically. So, the error message "cursor closed" came out.
If you put an error message into the question in text form, you may get caught when other people search for the same problem in the future.
© 2024 OneMinuteCode. All rights reserved.