From: James F. <ja...@we...> - 2002-10-08 23:45:02
|
Ype, I know the exception thrown was due to my code, that wasn't the bug I was reporting. The problem is that when an exception gets thrown I cannot exit the interpreter with Ctrl + Z & Enter. Instead I have to use Ctrl + C and answer yes to terminating the batch job. I have also noticed that exiting the command line while a java Frame is visible will cause it to hang. Neither are critical issues but both are definitely bugs - it should not be possible for my code to inhibit the command line from exiting correctly. Regards, James. > -----Original Message----- > From: Ype Kingma [mailto:yk...@xs...] > Sent: Thursday, September 26, 2002 2:05 AM > To: James Ferguson; jyt...@li... > Subject: Re: [Jython-users] Command-line interpreter bug. >=20 >=20 > James, >=20 > On Wednesday 25 September 2002 08:34, James Ferguson wrote: > > Anybody noticed the command-line hanging if you Ctrl+Z &=20 > Enter immediately > > after a java Exception gets thrown? > > > > eg. > > T:\Staff Files\jamesf\jython-2.1>jython > > *sys-package-mgr*: processing modified jar, 'T:\Staff > > Files\jamesf\jython-2.1\UnJim.jar' Jython 2.1 on=20 > java1.4.0_01-ea (JIT: > > null) > > Type "copyright", "credits" or "license" for more information. > > > > >>> from java.awt import * > > >>> from au.com.weblink.base.tool import * > > >>> from au.com.weblink.base.grid import * > > >>> from au.com.weblink.alarms import * > > >>> ab =3D AlarmBox() > > > > 0 > > 178 > > -148 > > > > Traceback (innermost last): > > File "<console>", line 1, in ? > > java.lang.StringIndexOutOfBoundsException: String index out=20 > of range: -1 > > at java.lang.StringBuffer.delete(Unknown Source) > > at > >=20 > au.com.weblink.base.grid.TitledList.getFormattedString(TitledL > ist.java:110) >=20 > It seems to me that an evt. problem is in the code mentioned=20 > here, not in=20 > Jython. >=20 > Regards, > Ype >=20 |
From: James F. <ja...@we...> - 2002-10-09 00:28:56
|
Alexey, The following demonstrates the open frame bug. I pressed Ctrl + Z and = enter and it hung. Ctrl + Break gave the read-out shown. Then closing the open = Frame caused it to prompt me with "Terminate batch job (Y/N)?". I would expect jython = to kill the=20 Frame itself on exit. Regards, James. >>> ^Z Full thread dump Java HotSpot(TM) Client VM (1.4.0_01-ea-b02 mixed = mode): "Thread-2" prio=3D5 tid=3D0x000348B0 nid=3D0x988 waiting on monitor = [0..7fb14] "AWT-EventQueue-0" prio=3D7 tid=3D0x0ABA6C68 nid=3D0x1d10 waiting on = monitor [12eff000 ..12effdb4] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at java.awt.EventQueue.getNextEvent(Unknown Source) - locked <03070690> (a java.awt.EventQueue) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown = Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown = Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) "AWT-Shutdown" prio=3D7 tid=3D0x0AB485B8 nid=3D0x1ab4 waiting on monitor = [ae7f000..ae7 fdb4] at java.lang.Object.wait(Native Method) - waiting on <0307F7C8> (a java.lang.Object) at java.lang.Object.wait(Unknown Source) at sun.awt.AWTAutoShutdown.run(Unknown Source) - locked <0307F7C8> (a java.lang.Object) at java.lang.Thread.run(Unknown Source) "AWT-Windows" daemon prio=3D7 tid=3D0x0AB48928 nid=3D0xad4 runnable = [aebf000..aebfdb4] at sun.awt.windows.WToolkit.eventLoop(Native Method) at sun.awt.windows.WToolkit.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "Signal Dispatcher" daemon prio=3D10 tid=3D0x009D1850 nid=3D0x1780 = waiting on monitor [0..0] "Finalizer" daemon prio=3D9 tid=3D0x0003E3C8 nid=3D0x4c8 waiting on = monitor [ad3f000.. ad3fdb4] at java.lang.Object.wait(Native Method) - waiting on <02F72B70> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(Unknown Source) - locked <02F72B70> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(Unknown Source) at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source) "Reference Handler" daemon prio=3D10 tid=3D0x0AA80718 nid=3D0x1998 = waiting on monitor [acff000..acffdb4] at java.lang.Object.wait(Native Method) - waiting on <02F72BD8> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Unknown Source) at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source) - locked <02F72BD8> (a java.lang.ref.Reference$Lock) "VM Thread" prio=3D5 tid=3D0x00A734D8 nid=3D0x1210 runnable "VM Periodic Task Thread" prio=3D10 tid=3D0x009D03A8 nid=3D0x12ec = waiting on monitor "Suspend Checker Thread" prio=3D10 tid=3D0x009D0DF0 nid=3D0xa44 runnable Terminate batch job (Y/N)? n T:\Staff Files\jamesf\jython-2.1> > -----Original Message----- > From: Alexey Solofnenko [mailto:A.S...@md...] > Sent: Wednesday, October 09, 2002 10:03 AM > To: James Ferguson; 'jyt...@li...' > Subject: RE: [Jython-users] Command-line interpreter bug. >=20 >=20 > Please press Ctrl-Break after that - it will print all java=20 > threads running. > Look for a thread that waits on something. >=20 > - Alexey. > -- > { http://trelony.cjb.net/ } Alexey N. Solofnenko > { http://www.inventigo.com/ } Inventigo LLC > Pleasant Hill, CA (GMT-8 usually) >=20 >=20 >=20 > -----Original Message----- > From: James Ferguson [mailto:ja...@we...]=20 > Sent: Tuesday, October 08, 2002 4:44 PM > To: yk...@xs...; jyt...@li... > Subject: RE: [Jython-users] Command-line interpreter bug. >=20 > Ype, >=20 > I know the exception thrown was due to my code, that wasn't > the bug I was reporting. The problem is that when an exception > gets thrown I cannot exit the interpreter with Ctrl + Z & Enter. > Instead I have to use Ctrl + C and answer yes to terminating the > batch job. I have also noticed that exiting the command line while > a java Frame is visible will cause it to hang. Neither are critical > issues but both are definitely bugs - it should not be possible > for my code to inhibit the command line from exiting correctly. >=20 > Regards, > James. >=20 >=20 >=20 |
From: James F. <ja...@we...> - 2002-10-09 00:51:32
|
I assume you meant "it doesN'T allow application...". The thing is that if I close the frame with frameFoo.dispose() and then=20 do Ctrl + Z and Enter jython exits correctly. I don't understand why jython doesn't correctly close the Frame itself on exit. James. > -----Original Message----- > From: Alexey Solofnenko [mailto:A.S...@md...] > Sent: Wednesday, October 09, 2002 10:45 AM > To: James Ferguson; 'jyt...@li...' > Subject: RE: [Jython-users] Command-line interpreter bug. >=20 >=20 > The log clearly shows that AWT was initialized. After it is=20 > initialized it > does allow application to exit unless System.exit() is called. >=20 > - Alexey. > -- > { http://trelony.cjb.net/ } Alexey N. Solofnenko > { http://www.inventigo.com/ } Inventigo LLC > Pleasant Hill, CA (GMT-8 usually) >=20 > -----Original Message----- > From: James Ferguson [mailto:ja...@we...]=20 > Sent: Tuesday, October 08, 2002 5:27 PM > To: Alexey Solofnenko; jyt...@li... > Subject: RE: [Jython-users] Command-line interpreter bug. >=20 > Alexey, >=20 > The following demonstrates the open frame bug. I pressed Ctrl=20 > + Z and enter > and > it hung. Ctrl + Break gave the read-out shown. Then closing=20 > the open Frame > caused > it to prompt me with "Terminate batch job (Y/N)?". I would=20 > expect jython to > kill the=20 > Frame itself on exit. >=20 > Regards, > James. >=20 > >>> ^Z >=20 > Full thread dump Java HotSpot(TM) Client VM (1.4.0_01-ea-b02=20 > mixed mode): >=20 > "Thread-2" prio=3D5 tid=3D0x000348B0 nid=3D0x988 waiting on monitor=20 > [0..7fb14] >=20 > "AWT-EventQueue-0" prio=3D7 tid=3D0x0ABA6C68 nid=3D0x1d10 waiting on = monitor > [12eff000 > ..12effdb4] > at java.lang.Object.wait(Native Method) > at java.lang.Object.wait(Unknown Source) > at java.awt.EventQueue.getNextEvent(Unknown Source) > - locked <03070690> (a java.awt.EventQueue) > at=20 > java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown > Source) >=20 > at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown > Source) > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > at java.awt.EventDispatchThread.pumpEvents(Unknown Source) > at java.awt.EventDispatchThread.run(Unknown Source) > ................. > =20 >=20 |
From: Samuele P. <ped...@bl...> - 2002-10-09 01:35:42
|
From: "James Ferguson" <ja...@we...> >I assume you meant "it doesN'T allow application...". > >The thing is that if I close the frame with frameFoo.dispose() and then >do Ctrl + Z and Enter jython exits correctly. I don't understand why >jython doesn't correctly close the Frame itself on exit. but what you see is a new shutdown behavior of AWT in 1.4, prior to that jython would hang even after a dispose. It is all a matter of placing a System.exit() on the exit path of jython for the interactive case - unless I'm missing something - at the moment it isn't there. regards. |
From: Kevin J. B. <jyt...@sa...> - 2002-10-09 21:10:37
|
From: "Samuele Pedroni" <ped...@bl...> >From: "James Ferguson" <ja...@we...> > > >>I assume you meant "it doesN'T allow application...". >> >>The thing is that if I close the frame with frameFoo.dispose() and then >>do Ctrl + Z and Enter jython exits correctly. I don't understand why >>jython doesn't correctly close the Frame itself on exit. >> >> > >but what you see is a new shutdown behavior of AWT in 1.4, prior to that jython >would hang even after a dispose. It is all a matter of placing a System.exit() >on the exit path of jython for the interactive case - unless I'm missing >something - at the moment it isn't there. > Samuele is correct. Pressing ctrl-Z<ENTER> lets the "main thread" terminate, it doesn't say "exit this process" (That's what sys.exit() and raise SystemExit are for). Jython has the same behavior as Java: import java.awt.*; public class Awt { public static void main( String[] args ) { new Frame().show(); System.out.println( "Exiting" ); } } Java does not (and _should_not_) destroy your Frame just because the main thread terminates. Example #2: public class Threads extends Thread { public void run() { try { sleep( 10000 ); } catch ( InterruptedException x ) { } } public static void main( String[] args ) { new Threads().start(); System.out.println( "Exiting" ); } } Java does not (and _should_not) exit when it prints "exiting", but rather when the sleep completes. kb |
From: James F. <ja...@we...> - 2002-10-09 23:51:01
|
Hmm... interesting. Thanks for the explanation Kevin. > -----Original Message----- > From: Kevin J. Butler [mailto:jyt...@sa...] > Sent: Thursday, October 10, 2002 7:11 AM > To: jyt...@li...; James Ferguson > Subject: Re: [Jython-users] Command-line interpreter bug. >=20 >=20 >=20 > From: "Samuele Pedroni" <ped...@bl...> >=20 > >From: "James Ferguson" <ja...@we...> > > =20 > > > >>I assume you meant "it doesN'T allow application...". > >> > >>The thing is that if I close the frame with=20 > frameFoo.dispose() and then > >>do Ctrl + Z and Enter jython exits correctly. I don't understand why > >>jython doesn't correctly close the Frame itself on exit. > >> =20 > >> > > > >but what you see is a new shutdown behavior of AWT in 1.4,=20 > prior to that jython > >would hang even after a dispose. It is all a matter of=20 > placing a System.exit() > >on the exit path of jython for the interactive case - unless=20 > I'm missing > >something - at the moment it isn't there. > > > Samuele is correct. >=20 > Pressing ctrl-Z<ENTER> lets the "main thread" terminate, it=20 > doesn't say=20 > "exit this process" (That's what sys.exit() and raise=20 > SystemExit are for). >=20 > Jython has the same behavior as Java: >=20 > import java.awt.*; >=20 > public class Awt > { > public static void main( String[] args ) > { > new Frame().show(); > System.out.println( "Exiting" ); > } > } >=20 > Java does not (and _should_not_) destroy your Frame just because the=20 > main thread terminates. >=20 > Example #2: >=20 > public class Threads > extends Thread > { > public void run() > { > try > { > sleep( 10000 ); > } > catch ( InterruptedException x ) > { > } > } > =20 > public static void main( String[] args ) > { > new Threads().start(); > System.out.println( "Exiting" ); > } > } >=20 > Java does not (and _should_not) exit when it prints "exiting", but=20 > rather when the sleep completes. >=20 > kb >=20 >=20 |
From: Jeff E. <je...@ad...> - 2002-10-11 02:39:26
|
You can see from the documentation of java.lang.Thread that the JVM exits when all non-daemon threads have died. When displaying a frame, AWT starts a non-daemon thread to handle GUI events. That AWT thread is one that causes your command line to hang after you kill the main thread. http://java.sun.com/j2se/1.4/docs/api/java/lang/Thread.html |
From: Alexey S. <A.S...@md...> - 2002-10-09 00:03:44
|
Please press Ctrl-Break after that - it will print all java threads running. Look for a thread that waits on something. - Alexey. -- { http://trelony.cjb.net/ } Alexey N. Solofnenko { http://www.inventigo.com/ } Inventigo LLC Pleasant Hill, CA (GMT-8 usually) -----Original Message----- From: James Ferguson [mailto:ja...@we...] Sent: Tuesday, October 08, 2002 4:44 PM To: yk...@xs...; jyt...@li... Subject: RE: [Jython-users] Command-line interpreter bug. Ype, I know the exception thrown was due to my code, that wasn't the bug I was reporting. The problem is that when an exception gets thrown I cannot exit the interpreter with Ctrl + Z & Enter. Instead I have to use Ctrl + C and answer yes to terminating the batch job. I have also noticed that exiting the command line while a java Frame is visible will cause it to hang. Neither are critical issues but both are definitely bugs - it should not be possible for my code to inhibit the command line from exiting correctly. Regards, James. |
From: Alexey S. <A.S...@md...> - 2002-10-09 00:45:02
|
The log clearly shows that AWT was initialized. After it is initialized it does allow application to exit unless System.exit() is called. - Alexey. -- { http://trelony.cjb.net/ } Alexey N. Solofnenko { http://www.inventigo.com/ } Inventigo LLC Pleasant Hill, CA (GMT-8 usually) -----Original Message----- From: James Ferguson [mailto:ja...@we...] Sent: Tuesday, October 08, 2002 5:27 PM To: Alexey Solofnenko; jyt...@li... Subject: RE: [Jython-users] Command-line interpreter bug. Alexey, The following demonstrates the open frame bug. I pressed Ctrl + Z and enter and it hung. Ctrl + Break gave the read-out shown. Then closing the open Frame caused it to prompt me with "Terminate batch job (Y/N)?". I would expect jython to kill the Frame itself on exit. Regards, James. >>> ^Z Full thread dump Java HotSpot(TM) Client VM (1.4.0_01-ea-b02 mixed mode): "Thread-2" prio=5 tid=0x000348B0 nid=0x988 waiting on monitor [0..7fb14] "AWT-EventQueue-0" prio=7 tid=0x0ABA6C68 nid=0x1d10 waiting on monitor [12eff000 ..12effdb4] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at java.awt.EventQueue.getNextEvent(Unknown Source) - locked <03070690> (a java.awt.EventQueue) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) ................. |
From: James F. <ja...@we...> - 2002-10-16 00:56:44
|
Okay correct me if I'm wrong: Jython is java code that runs on the JVM in thread A, using awt will = cause a second thread B to be started. Ctrl + Z and Enter causes thread = A to return from its run() method which would generally cause the JVM to = exit but since thread B is still running it doesn't. My first question would be why isn't the AWT thread a daemon thread? It = only exists for the use of other threads and if they've all exited it = isn't going to achieve anything but will stop the JVM from exiting. I = know this has got nothing to do with Jython but I'm curious to see if = there is a good reason for this. Now I understand that System.exit() would kill all threads and exit the = JVM so I guess that I could close jython using a System.exit() call. = Alternatively the jython interpreter could explicitly exit. This would = seem to be consistent with what you would expect the interpreter to do = when you close it, rather than leaving threads running. Is there any = downside to having the interpreter exit explicitly? Regards, James. > -----Original Message----- > From: Jeff Emanuel [mailto:je...@ad...] > Sent: Friday, October 11, 2002 1:03 PM > To: James Ferguson; jyt...@li... > Subject: Re: [Jython-users] Command-line interpreter bug. >=20 >=20 >=20 > You can see from the documentation of java.lang.Thread > that the JVM exits when all non-daemon threads have > died. When displaying a frame, AWT starts a non-daemon thread > to handle GUI events. That AWT thread is one that causes your > command line to hang after you kill the main thread. >=20 > http://java.sun.com/j2se/1.4/docs/api/java/lang/Thread.html >=20 |
From: James F. <ja...@we...> - 2002-10-16 01:04:15
|
On second thoughts I see why the AWT thread is not a daemon. As long as = something is visible an event could occur which would run user code but = would have no relation to any other thread. Fair enough. Though I still don't see why the interpreter shouldn't System.exit() James. |
From: Alexey S. <A.S...@md...> - 2002-10-16 02:47:56
|
I would prefer for Jython not to call the method, because otherwise it would be more difficult to run it from my java programs. On the other hand you can call sys.exit(rc) with exactly the same results. - Alexey. -- { http://trelony.cjb.net/ } Alexey N. Solofnenko { http://www.inventigo.com/ } Inventigo LLC Pleasant Hill, CA (GMT-8 usually) |
From: Samuele P. <ped...@bl...> - 2002-10-16 07:08:14
|
Do you call org.python.util.jython programattically ? ----- Original Message ----- From: "Alexey Solofnenko" <A.S...@md...> To: "'James Ferguson'" <ja...@we...>; <jyt...@li...> Sent: Wednesday, October 16, 2002 4:47 AM Subject: RE: [Jython-users] Command-line interpreter bug. > I would prefer for Jython not to call the method, because otherwise it would > be more difficult to run it from my java programs. On the other hand you can > call sys.exit(rc) with exactly the same results. > > - Alexey. > -- > { http://trelony.cjb.net/ } Alexey N. Solofnenko > { http://www.inventigo.com/ } Inventigo LLC > Pleasant Hill, CA (GMT-8 usually) > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: viaVerio will pay you up to > $1,000 for every account that you consolidate with us. > http://ad.doubleclick.net/clk;4749864;7604308;v? > http://www.viaverio.com/consolidator/osdn.cfm > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |
From: Stefaan <do...@na...> - 2002-10-16 11:20:52
|
Hi All, This is what I'm doing: PyList pyList = new PyList(); Object list = pyList.__tojava__(java.util.List.class) object pylist is coerced to a PySingleton object with getName() = "Error". what gives? All hints are welcome. Thanks, Stefaan Nachtergaele -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of Samuele Pedroni Sent: woensdag 16 oktober 2002 9:00 To: Alexey Solofnenko; jyt...@li... Subject: Re: [Jython-users] Command-line interpreter bug. Do you call org.python.util.jython programattically ? ----- Original Message ----- From: "Alexey Solofnenko" <A.S...@md...> To: "'James Ferguson'" <ja...@we...>; <jyt...@li...> Sent: Wednesday, October 16, 2002 4:47 AM Subject: RE: [Jython-users] Command-line interpreter bug. > I would prefer for Jython not to call the method, because otherwise it would > be more difficult to run it from my java programs. On the other hand you can > call sys.exit(rc) with exactly the same results. > > - Alexey. > -- > { http://trelony.cjb.net/ } Alexey N. Solofnenko > { http://www.inventigo.com/ } Inventigo LLC > Pleasant Hill, CA (GMT-8 usually) > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: viaVerio will pay you up to > $1,000 for every account that you consolidate with us. > http://ad.doubleclick.net/clk;4749864;7604308;v? > http://www.viaverio.com/consolidator/osdn.cfm > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users ------------------------------------------------------- This sf.net email is sponsored by: viaVerio will pay you up to $1,000 for every account that you consolidate with us. http://ad.doubleclick.net/clk;4749864;7604308;v? http://www.viaverio.com/consolidator/osdn.cfm _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users |
From: Oti <oh...@ya...> - 2002-10-28 06:22:34
|
[ Stefaan ] > Hi All, > This is what I'm doing: > > PyList pyList = new PyList(); > Object list = pyList.__tojava__(java.util.List.class) > object pylist is coerced to a PySingleton object with getName() = > "Error". > > what gives? > All hints are welcome. Hi Stefaan, i can't see why you want to instantiate a PyList from scratch ? Maybe the folloing example gives you a hint. It shows how to get the java.util.List object out of an embedded interpreter. AFAIK this is the 'default' usage of the __tojava__ method: package CH.obj.Test; import java.util.ArrayList; import java.util.List; import org.python.core.PyObject; import org.python.util.PythonInterpreter; public class ListDemo { public List getList() { List list = new ArrayList(); list.add( "first element" ); return list; } public static void main( String args[] ) { PythonInterpreter interpreter = new PythonInterpreter(); interpreter.initialize( null, null, null ); interpreter.exec("from CH.obj.Test import ListDemo"); interpreter.exec("listDemo = ListDemo()"); PyObject pyObject = interpreter.eval("listDemo.getList()"); // this is a PyJavaInstance, not a PyList List list = (List) pyObject.__tojava__( List.class ); System.out.println( "list = " + list ); } } Best wishes, Oti. __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ |
From: Samuele P. <ped...@bl...> - 2002-10-16 11:25:14
|
From: "Samuele Pedroni" <ped...@bl...> > Do you call org.python.util.jython programattically ? > obviously as org.python.util.jython.main and less obviously I'm asking about in interactive mode (not to run a script)? |
From: Kevin J. B. <jyt...@sa...> - 2002-10-17 18:07:33
|
From: "James Ferguson" <ja...@we...> >On second thoughts I see why the AWT thread is not a daemon. As long as = >something is visible an event could occur which would run user code but = >would have no relation to any other thread. Fair enough. Yes. >Now I understand that System.exit() would kill all threads and exit the = >JVM so I guess that I could close jython using a System.exit() call. = >Alternatively the jython interpreter could explicitly exit. This would = >seem to be consistent with what you would expect the interpreter to do = >when you close it, rather than leaving threads running. Is there any = >downside to having the interpreter exit explicitly? Same reason applies - if I start a GUI from the command-line then exit the command-line, Jython can't be sure if I want the GUI to still be around, but I'm done with the interpreter, or if I want to terminate the GUI AND the interpreter. Same applies for other secondary, non-daemon threads (a process listening on some socket for instance). You could argue that when the command-line interpreter executes, it is supposed to be the primary interface, and is the only one that matters. This is probably true in most cases, but if you implemented it that way, you'd have to provide a separate mechanism to tell the interpreter NOT to exit in those times when it isn't the master. Something like the 'nohup' mechanism for Unix shells, etc. Much simpler to say, "Exiting the command-line interpreter just exits the command-line interpreter, if you want to terminate the VM, then explicitly terminate the VM." kb |
From: Samuele P. <ped...@bl...> - 2002-10-17 18:40:12
|
From: "Kevin J. Butler" <jyt...@sa...> > Same reason applies - if I start a GUI from the command-line then exit the command-line, Jython can't be sure if I want the GUI to still be around, but I'm done with the interpreter, or if I want to terminate the GUI AND the interpreter. > > Same applies for other secondary, non-daemon threads (a process listening on some socket for instance). > > You could argue that when the command-line interpreter executes, it is supposed to be the primary interface, and is the only one that matters. This is probably true in most cases, but if you implemented it that way, you'd have to provide a separate mechanism to tell the interpreter NOT to exit in those times when it isn't the master. Something like the 'nohup' mechanism for Unix shells, etc. > > Much simpler to say, "Exiting the command-line interpreter just exits the command-line interpreter, if you want to terminate the VM, then explicitly terminate the VM." I had already changed things in CVS, now Ctrl-Z(Win)/Ctrl-D(Unix) in interactive mode kill the JVM even if there's a thread running. Knowing what is going on, I had no problems with the old behavior, still it is not the more natural. Only if someone has a case where she needed the old behavior I will revert the change or add ways control it. regards. |
From: Kevin J. B. <pub...@sa...> - 2002-10-17 23:03:50
|
From: "Samuele Pedroni" <ped...@bl...> >I had already changed things in CVS, now Ctrl-Z(Win)/Ctrl-D(Unix) in >interactive mode kill the JVM even if there's a thread running. >Knowing what is going on, I had no problems with the old behavior, still it is >not the more natural. > > Hmm. Now I'll have to figure out how much of my "natural" expectation was preconditioning from familiarity w/ Java threading behavior! :-) kb |
From: <pd...@qu...> - 2002-10-18 11:41:53
|
I'm new to Jython (and Python for that matter) so these might be FAQs but I can't find an answer anywhere. I'm running Jython on Windows (NT, XP). #1. If I 'open' a file (mode 'wb') and write() to it, the file ends up truncated if I forget to close() it before the script exits. This seems to be different behavior to Python (and Perl etc). If I close() it is is correcly flushed and the file is complete on script exit. #2. If I open a file as 'wb' and write a line-ending '\n', I get just a (unix- style) '\n' in the output file as expected. But if I write to sys.stdout, Jython is doing LF -> CRLF translation so the file ends up with a windows-sytle '\r\n'. Is there a way to control this behavior, if I really just want a '\n'? (In perl I can control by the filemode of stdout - is there a Jython/Python equivalent?) Thanks, Patrick |