Re: import caching
"Jason Persampieri" <[email protected]> Tue, 8 Jan 2008 20:40:43 -0500
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
--===============1296617782== Content-Type: multipart/alternative; boundary="----=_Part_5022_20280681.1199842843603" ------=_Part_5022_20280681.1199842843603 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline > > > I am using Spyce with mod_python. > > > > Spyce seems to be caching imported Python modules. > > that's the python interpreter doing the caching. > > > Unfortunately, it > > doesn't (always?) refresh the cache when the module changes. Quite > often > > I've had to restart apache after making a change in an imported module. > > spyce has a check_modules_and_restart option, which defaults to True. > this makes spyce scan the python interpreter's module cache and restart > the spyce process when a source file changes. unfortunately though it > does not work with mod_python. it should be possible to make it work > with mod_python but I have never run mod_python myself and don't intend > to start. > > the easiest solution is to just use the built-in spyce web server for > development and only use mod_python (or proxy the spyce server w/ > apache, which is my preferred option) for production. > > -Jonathan > I've switched over to the standalone web-server and was still seeing this problem. It was especially prevalent when dynamically deciding between importing "foo/lib.py" and "bar/lib.py". Of course, since you have to munge the sys.path to do either, this behavior is expected. I worked around it by including "del sys.modules['lib']" just before my import line. _jason ------=_Part_5022_20280681.1199842843603 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline <div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">> I am using Spyce with mod_python.<br>><br> > Spyce seems to be caching imported Python modules.<br><br></div>that's the python interpreter doing the caching.<br><div class="Ih2E3d"><br>> Unfortunately, it<br>> doesn't (always?) refresh the cache when the module changes. Quite often <br>> I've had to restart apache after making a change in an imported module.<br><br></div>spyce has a check_modules_and_restart option, which defaults to True.<br>this makes spyce scan the python interpreter's module cache and restart <br>the spyce process when a source file changes. unfortunately though it<br>does not work with mod_python. it should be possible to make it work<br>with mod_python but I have never run mod_python myself and don't intend <br>to start.<br><br>the easiest solution is to just use the built-in spyce web server for<br>development and only use mod_python (or proxy the spyce server w/<br>apache, which is my preferred option) for production.<br><font color="#888888"> <br>-Jonathan<br></font></blockquote></div><br>I've switched over to the standalone web-server and was still seeing this problem. It was especially prevalent when dynamically deciding between importing "foo/lib.py" and "bar/lib.py". Of course, since you have to munge the sys.path to do either, this behavior is expected. I worked around it by including "del sys.modules['lib']" just before my import line.<br><br>_jason<br> ------=_Part_5022_20280681.1199842843603-- --===============1296617782== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace --===============1296617782== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Spyce-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spyce-users --===============1296617782==--