Re: How to 'shut down' the InteractiveConsole?
David Charles <[email protected]>
| Newsgroups | gmane.comp.lang.jython.user |
|---|---|
| Message-ID | <CAJHoYyJ9yoQOZNeenUpqANjV8H=KqRh6aZCG_LAq1_o8GDG3kA@mail.gmail.com> |
No, I see identical behavior. D On Sat, Nov 7, 2015 at 9:34 AM, Jeff Emanuel <[email protected]> wrote: > Does it exit if you replace InteractiveConsole with PythonInterpreter? > > > On 11/5/2015 5:38 PM, David Charles wrote: > > Greetings Jythonistas, > > I have a Jython program that runs and exit normally when I invoke it in > this way: > > $ jython myprogram.py args > > But runs to its end and _does_not_exit_ when I embed it inside of a *.jar > file and invoke it in this way: > > $ java -classpath jar1:jar2:jar3 MainClass args > > I must send a ctrl-C to stop my program when I run it in this way. > > I have embedded the Jython interpreter in the following manner: > > // Configure the Jython interpreter. > Properties preProps = PySystemState.getBaseProperties(); > // preProps.put("python.cachedir.skip", false); > Properties postProps = new Properties(); > postProps.put("python.cachedir.skip", false); > postProps.put("python.path", ""); > PySystemState.initialize(preProps, postProps, appArgs); > > // Start the Jython interpreter. > InteractiveConsole con = new InteractiveConsole(); > // I found that for some reason, when running under java web start > // sys.prefix is None and the Lib directory under the jython.jar > // is not added to the sys.path automatically. > con.exec("import sys"); > con.exec("sys.path.append(\"__pyclasspath__/Lib\")"); > con.exec("sys.prefix = \"\""); > > // Execute the application 'launch code' on the interpreter. > con.exec(appLaunchCode); > > Other Jython programs, embedded in the same manner, do not exhibit this > problem. I suspect this application does something a little... different. > But, why then does my application exit normally when I run it on > $JYTHON_HOME/bin/jython? > > Thanks, > David > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Jython-users mailing [email protected]://lists.sourceforge.net/lists/listinfo/jython-users > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Jython-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jython-users > > ------------------------------------------------------------------------------ Presto, an open source distributed SQL query engine for big data, initially developed by Facebook, enables you to easily query your data on Hadoop in a more interactive manner. Teradata is also now providing full enterprise support for Presto. Download a free open source copy now. http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140 _______________________________________________ Jython-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jython-users