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


Messages In This Thread
pool mysql error - not catch by try\except? - by korenron - Jul-05-2021, 08:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mysql and mysql.connector error lostintime 2 731 Oct-03-2023, 10:25 PM
Last Post: lostintime
  try catch not working? korenron 2 879 Jan-15-2023, 01:54 PM
Last Post: korenron
  Multiprocessing Pool Multiple Instances How to Kill by Pool ID sunny9495 0 780 Nov-16-2022, 05:57 AM
Last Post: sunny9495
  Mysql Syntax error in pymysql ilknurg 4 2,413 May-18-2022, 06:50 AM
Last Post: ibreeden
  Multiprocessing queue catch get timeout Pythocodras 1 2,376 Apr-22-2022, 06:01 PM
Last Post: Pythocodras
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,277 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  twisted: catch return from sql wardancer84 0 1,549 Sep-08-2021, 12:38 PM
Last Post: wardancer84
  mySQL Database error not resolving. cybertooth 2 3,265 Aug-30-2021, 05:45 PM
Last Post: ibreeden
  Pool multiprocessing - know current status in loop? korenron 0 1,660 Jul-28-2021, 08:49 AM
Last Post: korenron
  MYSQL.CONNECTOR ERROR DB1 8 3,925 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