1

i'm currently working on the VMware SDK in python (with Pyvmomi) and I see in all sample or example this line:

atexit.register(Disconnect, self.si)

Does anyone know what does is supposed do ? I don't understand, thanks for ur help.

Anthony
  • 177
  • 1
  • 4
  • 14

1 Answers1

4

In a program, you may have uncaught exceptions, or something else like a socket which is kept open, this leads to undesired behaviors. To resolve this, the module atexit is there for you.

It allows you to register multiples functions / methods to call at program end. If the object is deleted, self.disconnect() is called.