Problem with reimporting modules

2007-02-11 Thread Christoph Zwerschke
I'm currently investigating a problem that can hit you in TurboGears when Kid template modules are reloaded in the background, because in certain situations, global variables suddenly are set to None values. I tracked it down to the following behavior of Python. Assume you have a module

Re: Problem with reimporting modules

2007-02-11 Thread Dustan
On Feb 11, 5:53 am, Christoph Zwerschke [EMAIL PROTECTED] wrote: I'm currently investigating a problem that can hit you in TurboGears when Kid template modules are reloaded in the background, because in certain situations, global variables suddenly are set to None values. I tracked it down to

Re: Problem with reimporting modules

2007-02-11 Thread Christoph Zwerschke
Yes I know about reload(), but TurboGears (TurboKid) does not use it and the docs say that removing modules from sys.module is possible to force reloading of modules. I don't want to rewrite everything since it's a pretty complex thing with modules which are compiled from templates which can

Re: Problem with reimporting modules

2007-02-11 Thread Gabriel Genellina
En Sun, 11 Feb 2007 15:56:16 -0300, Christoph Zwerschke [EMAIL PROTECTED] escribió: Yes I know about reload(), but TurboGears (TurboKid) does not use it and the docs say that removing modules from sys.module is possible to force reloading of modules. I don't want to rewrite everything since

Re: Problem with reimporting modules

2007-02-11 Thread Christoph Zwerschke
Thanks for the detailed explanations, Gabriel. At that time, all values in the module namespace are set to None (for breaking possible cycles, I presume). print_hello now has a func_globals with all names set to None. (Perhaps the names could have been deleted instead, so print_hello()