MySQL Forums
Forum List  »  Connector/Python

Re: Python and MySql
Posted by: Peter Brawley
Date: May 19, 2021 04:30PM

Any MySQL call that can fail needs error handling, eg ...

try:
  cnx = ...
  mycursor = ...
  mycursor.execute(...)  
  cnx.close()
except mysql.connector.Error as err:
  print("Error: {}".format(err))

Options: ReplyQuote


Subject
Written By
Posted
May 19, 2021 03:31PM
Re: Python and MySql
May 19, 2021 04:30PM
May 19, 2021 05:03PM
May 19, 2021 07:34PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.