None module reference

Peter Hansen peter at engcorp.com
Mon May 23 11:18:10 EDT 2005


Stefan Seefeld wrote:
> In a python module of mine I import system modules
> ('sys', say) and then use them from within some functions.
> 
> However, during program termination I'm calling
> one such function and the module reference ('sys')
> is 'None' !

Are you running any daemon threads?  This can generally happen when a 
daemon thread continues to access module globals during the interpreter 
shutdown sequence.  At one stage all globals in all modules are rebound 
to None, and there's a chance some of your daemon thread code will 
execute just as this is occurring, resulting in that kind of error message.

-Peter



More information about the Python-list mailing list