Python Forum
pool mysql error - not catch by try\except?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pool mysql error - not catch by try\except?
#1
Hello,
I'm using Pool function to run several mysql command 'update'

I guess I have some connection problems because I'm gettig this error:
mysql.connector.errors.OperationalError: MySQL Connection not available.
maybe netwrok isuses or my sql server is down - I'm checking it now

but why the try didn't catch the exception and continue ?
            try:
                mycursor1 = mydb.cursor()
                sql1 = f"update david.david_test set ROU_COMMENT = '" + Upload_Status + "',SendTime=NOW() where rou_ip = '" + Unit_IP + "';"
                print(Upload_Status)
                mycursor1.execute(sql1)
                mydb.commit()
            except mysql.connector.Error as err:
                print("Something went wrong: {}".format(err))
            except Exception as e:
                print(e)
                print('MYSQL Problem?')
is it beacuse the Pool function is not also in try\except?

if __name__ == '__main__':
    StartTime = datetime.now()
    Device_List = getListFromMysql()
    Final_List = []
    with Pool(10) as p:
        Final_List = p.map(GetUplaudFies, Device_List)
       
Thanks,
Reply
#2
The complete error stack trace should tell you in which line of your code the exception occurred. We need to know this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql and mysql.connector error lostintime 2 679 Oct-03-2023, 10:25 PM
Last Post: lostintime
  try catch not working? korenron 2 844 Jan-15-2023, 01:54 PM
Last Post: korenron
  Multiprocessing Pool Multiple Instances How to Kill by Pool ID sunny9495 0 764 Nov-16-2022, 05:57 AM
Last Post: sunny9495
  Mysql Syntax error in pymysql ilknurg 4 2,355 May-18-2022, 06:50 AM
Last Post: ibreeden
  Multiprocessing queue catch get timeout Pythocodras 1 2,313 Apr-22-2022, 06:01 PM
Last Post: Pythocodras
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,044 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  twisted: catch return from sql wardancer84 0 1,531 Sep-08-2021, 12:38 PM
Last Post: wardancer84
  mySQL Database error not resolving. cybertooth 2 3,214 Aug-30-2021, 05:45 PM
Last Post: ibreeden
  Pool multiprocessing - know current status in loop? korenron 0 1,636 Jul-28-2021, 08:49 AM
Last Post: korenron
  MYSQL.CONNECTOR ERROR DB1 8 3,843 Jul-23-2021, 03:31 AM
Last Post: DB1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020