79568370

Date: 2025-04-11 08:32:19
Score: 1
Natty:
Report link

Found a solution.
Forced a cleanup before Python starts tearing down the logging module.

Import this library into the code:

import atexit

and add this at the end of the code:

def cleanup():
    plc.disconnect()
    plc.destroy()

atexit.register(cleanup)

After executing the script, the original error doesn't occur, and now we can remove the atexit portion of the code and execute like normal.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Arkeiro