You are using the variable "c" for different things:
Also: when an error occurs, please show the complete error message.
c = input('Enter the chapter: ') ... c = conn.cursor()This does not explain the error message, but you should repair this first.
Also: when an error occurs, please show the complete error message.