atexit not being executed

Chris Gorton cs_gorton at hotmail.com
Tue May 3 14:27:24 EDT 2005


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

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

Can you think of any possible workarounds for this?

>From: Skip Montanaro <skip at pobox.com>
>To: "Chris Gorton" <cs_gorton at hotmail.com>
>CC: python-list at python.org
>Subject: Re: atexit not being executed
>Date: Tue, 3 May 2005 09:57:11 -0500
>
>
>     Chris> I tried looking through the documentation ...
>
>Always a good first step... <wink>
>
>     Chris> ... and came across atexit. I tried putting this into my code 
>and
>     Chris> it never seems to actually process the atexit.register(....)
>     Chris> function thus leaving me stranded. My question is what might be
>     Chris> the reason for this happening ...
>
>You didn't post any code, so I can only guess, however, if your program
>exits other than by calling Py_Finalize (that is, if your program crashes 
>or
>you kill it forcefully), I don't think your registered exit functions will
>be called.  If that's not the situation, post some code so people can see 
>if
>you're using the module correctly.
>
>Skip
>





More information about the Python-list mailing list