atexit not being executed

Skip Montanaro skip at pobox.com
Tue May 3 16:11:46 EDT 2005


    Chris> The environment in which I am working is client/server and it is
    Chris> the server that processes all python code. I have tried creating
    Chris> a file (which in the case of what I have explained means that I
    Chris> can't issue a close command) and let the process run as I have
    Chris> before. When the process has finished and I try deleting the file
    Chris> I get a permission denied error. As soon as I stop the server for
    Chris> the environment it frees up the resources to this file. Not quite
    Chris> sure how they could be implmenting the python.

    Chris> I am assuming then that the Py_Finalize is not being called until
    Chris> maybe when the server terminates. This being the case it would
    Chris> not be any good as the server should be 'Up' all of the time!.

Yes, Py_Finalize is called at program exit.  It sounds to me like atexit is
doing exactly what it's supposed to do.  When the program exits, that file
will be closed.

    Chris> Can you think of any possible workarounds for this?

Other than figuring out a way to close the file at some other point during
server execution, no.

Skip



More information about the Python-list mailing list