From: <wer...@gm...> - 2007-08-09 05:45:52
|
Both options for reloading a module work. The sys.modules version can also be done in a less radical style: After > del sys.modules["foo_module"] subsequent import of foo_module results in the import of the latest version. Anyway, thanks a lot for your support. Kind regards Markus -------- Original-Nachricht -------- Datum: Thu, 2 Aug 2007 09:17:59 +0530 Von: "Utkarsh Upadhyay" <mus...@gm...> An: "David Handy" <Dav...@sa...> CC: wer...@gm..., jyt...@li... Betreff: Re: [Jython-users] How to run a .py file from Jython > Well, in Python, there is a brute-force way of reloading all modules, and > that is clearing out sys.modules dictionary. I wonder if that works in > Jython. > > PS: There is also a safe way of doing it, which reloads only the modules > that your program loads .. saving the initial sys.modules before your > program loads and resetting the sys.modules to it when you need to reload > the modules. > > Do tell me if it works. > > ~musically_ut > > On 8/1/07, David Handy <Dav...@sa...> wrote: > > > > If you repeat the command: > > > > import program_foo > > > > nothing will happen. You have to do this: > > > > reload(program_foo) > > > > to re-import a module whose source file has changed. But this won't > > re-load any other module that program_foo.py imported, so if those files > > changed you still have a problem. > > > > Maybe your other idea of running a start.bat file from main.py is a > better > > idea. > > > > David H > > > > -----Original Message----- > > From: jyt...@li... [mailto: > > jyt...@li...] On Behalf Of > > wer...@gm... > > Sent: Wednesday, August 01, 2007 11:03 AM > > To: Utkarsh Upadhyay > > Cc: jyt...@li... > > Subject: Re: [Jython-users] How to run a .py file from Jython > > > > Thank you for your reply. > > Sorry, I must give some more background information. Let's say main.py > is > > a basic editor; I edit program_foo.py in main.py and want to start it > from > > main after editing. If I repeat the import statment after editing; will > the > > edited version be reimported and executed? > > > > > > > > > > > import program_foo.py > > > > > > should be able to do it. > > > > > > > Thanks again > > > > Markus > > -- > > Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! > > Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> > http://get.splunk.com/_______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > -- > Never trust a spiritual leader who cannot dance. ~Mr. Miyagi, The Next > Karate Kid -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kanns mit allen: http://www.gmx.net/de/go/multimessenger |