Sayth Renshaw <flebber.c...@gmail.com> writes: > with conn, conn.cursor() as cur:
What are you expecting this ‘with’ statement to do? As you've written it, the statement declares your intent to enter both ‘conn’ and ‘conn.cursor()’ as context managers. <URL:https://docs.python.org/3/reference/compound_stmts.html#with> To “enter a context manager” entails calling the ‘__enter__’ method on the context manager object. So that will happen to both ‘conn’ and ‘conn.cursor()’. Are both of those objects context managers? If not, you will get the error that you reported. -- \ “Pinky, are you pondering what I'm pondering?” “I think so, | `\ Brain, but if we get Sam Spade, we'll never have any puppies.” | _o__) —_Pinky and The Brain_ | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list