From: Aurelien M. <aur...@fr...> - 2003-06-24 12:48:41
|
Hello to all, I have the same problem than this person: > I'm trying to add Python scripting capabilities to an existing Java > application. I would need to be able to execute scripts fully > independently in different threads. I've attempted this by creating > an instance of PythonInterpreter in each of the threads. This = approach > appears to work, but not perfectly. For example, all interpreters > share the same IO streams -- calling setOut(), setErr(), etc. on any > of the interpreters will redirect *all* of the interpreters to the > new stream. The problem is that I want to use several independant Jython = console,=20 with independant error output. And, at this time, i have strange things=20= like output only in the last open console, etc. Does anyone have an idea to change this ? I've seen this answer: > >Stdout/stderr are 'one per process'. You'll have to use your own > >output functions (or methods) in your threads. You can use > >the thread identity provided by Jython to select a network > >connection in your output functions. > > > >You could even replace > >sys.stdout and sys.stderr by objects doing precisely that, > >(make sure to synchronize though, see below). > >Have a look at console.py in the jython distribution for > >an example of stream redirection. But i don't understand it. If anyone have an example that i can = use in=20 my java project, or an another explanation ?? Aur=E9lien Mazurie |
From: Michel P. <mi...@di...> - 2003-06-25 00:10:22
|
On Tuesday 24 June 2003 07:54, Aurelien Mazurie wrote: > Hello to all, > > =09I have the same problem than this person: > > I'm trying to add Python scripting capabilities to an existing Java > > application. I would need to be able to execute scripts fully > > independently in different threads. I've attempted this by creating > > an instance of PythonInterpreter in each of the threads. This approa= ch > > appears to work, but not perfectly. For example, all interpreters > > share the same IO streams -- calling setOut(), setErr(), etc. on any > > of the interpreters will redirect *all* of the interpreters to the > > new stream. > > =09The problem is that I want to use several independant Jython console= , > with independant error output. And, at this time, i have strange things > like output only in the last open console, etc. You must pass an explicit, new system state into a PythonInterpreter inst= ance: new PythonInterpreter(dict, state); otherwise PythonInterpreter will acquire the default system state. setEr= r=20 just calls the coresponding method on the state, which is why all your=20 interpreters follow suite when you call it; they are all sharing the same= =20 state to begin with. > > =09Does anyone have an idea to change this ? I've seen this answer: > > >Stdout/stderr are 'one per process'. You'll have to use your own > > >output functions (or methods) in your threads. This is not entirely true, you can create a new state and then instanciat= e a=20 new interpreter with it; then call setErr and setOut with new file-like=20 objects. I use classes that buffer output and then update a swing text p= ane. Note that InteractiveConsole, InteractiveInterpreter and ReadlineConsole = all =20 shadow the second explicit state argument to the PythonInterpreter=20 constructor and cannot be used to create multiple independent interpreter= s. =20 This is a bug. Jydle works around this by subclassing PythonInterpreter and repoducing t= he=20 InteractiveConsole functionality in a Python class. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jydle/Jydle/Console/ see MyInterpreter.py and ConsolePane.py -Michel |
From: Tom J. <to...@ne...> - 2003-06-25 04:52:27
|
Hmmm, I hadn't noticed Jydle before, I'm fairly new to the lists so it may have been discussed. I checked it out from cvs.sourceforge.net and played around with it a little bit, but couldn't really see any specific goals to it other than being an IDE for jython. Are there plans to add in a GUI builder? Looks very promising. The pages at sourceforge are blank as far as explanations, and I'm not familiar with IDLE to know what to expect. Tom |
From: Michel P. <mi...@di...> - 2003-06-25 05:24:00
|
On Tuesday 24 June 2003 23:57, Tom Jensen wrote: > Hmmm, I hadn't noticed Jydle before, I'm fairly new to the lists so it > may have been discussed. Not too much. The first release had a bug in it and I haven't made a sec= ond=20 release yet. > I checked it out from cvs.sourceforge.net and > played around with it a little bit, but couldn't really see any specifi= c > goals to it other than being an IDE for jython.=20 That about sums up the goals. An integrated browser, editor, and console= =2E =20 Jydle is a pet project of mine, for fun and mastery of Jython and Java. = No=20 real goals except bugs and a TODO list. BTW, did it work ok for you? > Are there plans to add > in a GUI builder?=20 No plans, a GUI builder would be cool but I don't have a grasp of the pro= blem=20 because I've never used one. =20 > Looks very promising. The pages at sourceforge are > blank as far as explanations, and I'm not familiar with IDLE to know > what to expect. Its shares no code with IDLE and does not attempt to clone it to any degr= ee. =20 I did steal the Python colorization algorithm from IDLE. I guess the g= oals=20 are similar though, something for people to poke around with and explore=20 Jython and Java. I'd like to get it into a more releasable state soon. I'm still hung up= on=20 the details but I would like to eventually make it a self-contiained .jar= =2E =20 I'd also like some translations of the resource files into other language= s. -Michel |
From: Tom J. <to...@ne...> - 2003-06-25 14:42:05
|
Jydle definitely worked for me, there were a few things here and there, but it was fairly straightforward to get around in. I liked the browser so I could see all of the classes and what methods were on them. Would you ever consider integrating the javadocs into it? That would be really cool to have that in there. So far my experience of translating java to jython (python) has been that it is fairly simple (I've been fooling around with swing objects and the javax.sound.midi package). The GUI builder I was thinking of, I've fallen out of practice with them since the advent of web pages, is something simple like the old VB 3.0 or Delphi 3.0 interface, where you basically have a toolbar that has a bunch of buttons for the various visual components you can put on a window, then there is a second toolbar that shows you the properties that you can edit on the currently highlighted component, and also name methods that tie into the various events for the given component. Then it would just generate the code automatically for you (although in VB 3.0 it would hide all of that code from you if I remember right). I've just got a few small pet projects that a simple GUI builder like that would make it even quicker to prototype with. Tom Michel Pelletier wrote: >On Tuesday 24 June 2003 23:57, Tom Jensen wrote: > > >>Hmmm, I hadn't noticed Jydle before, I'm fairly new to the lists so it >>may have been discussed. >> >> > >Not too much. The first release had a bug in it and I haven't made a second >release yet. > > > >> I checked it out from cvs.sourceforge.net and >>played around with it a little bit, but couldn't really see any specific >>goals to it other than being an IDE for jython. >> >> > >That about sums up the goals. An integrated browser, editor, and console. >Jydle is a pet project of mine, for fun and mastery of Jython and Java. No >real goals except bugs and a TODO list. BTW, did it work ok for you? > > > >>Are there plans to add >>in a GUI builder? >> >> > >No plans, a GUI builder would be cool but I don't have a grasp of the problem >because I've never used one. > > > >>Looks very promising. The pages at sourceforge are >>blank as far as explanations, and I'm not familiar with IDLE to know >>what to expect. >> >> > >Its shares no code with IDLE and does not attempt to clone it to any degree. >I did steal the Python colorization algorithm from IDLE. I guess the goals >are similar though, something for people to poke around with and explore >Jython and Java. > >I'd like to get it into a more releasable state soon. I'm still hung up on >the details but I would like to eventually make it a self-contiained .jar. >I'd also like some translations of the resource files into other languages. > >-Michel > > >------------------------------------------------------- >This SF.Net email is sponsored by: INetU >Attention Web Developers & Consultants: Become An INetU Hosting Partner. >Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! >INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php >_______________________________________________ >Jython-users mailing list >Jyt...@li... >https://lists.sourceforge.net/lists/listinfo/jython-users > > > |
From: Tom J. <to...@kr...> - 2003-06-25 14:35:25
|
Jydle definitely worked for me, there were a few things here and there, but it was fairly straightforward to get around in. I liked the browser so I could see all of the classes and what methods were on them. Would you ever consider integrating the javadocs into it? That would be really cool to have that in there. So far my experience of translating java to jython (python) has been that it is fairly simple (I've been fooling around with swing objects and the javax.sound.midi package). The GUI builder I was thinking of, I've fallen out of practice with them since the advent of web pages, is something simple like the old VB 3.0 or Delphi 3.0 interface, where you basically have a toolbar that has a bunch of buttons for the various visual components you can put on a window, then there is a second toolbar that shows you the properties that you can edit on the currently highlighted component, and also name methods that tie into the various events for the given component. Then it would just generate the code automatically for you (although in VB 3.0 it would hide all of that code from you if I remember right). I've just got a few small pet projects that a simple GUI builder like that would make it even quicker to prototype with. Tom Michel Pelletier wrote: >On Tuesday 24 June 2003 23:57, Tom Jensen wrote: > > >>Hmmm, I hadn't noticed Jydle before, I'm fairly new to the lists so it >>may have been discussed. >> >> > >Not too much. The first release had a bug in it and I haven't made a second >release yet. > > > >> I checked it out from cvs.sourceforge.net and >>played around with it a little bit, but couldn't really see any specific >>goals to it other than being an IDE for jython. >> >> > >That about sums up the goals. An integrated browser, editor, and console. >Jydle is a pet project of mine, for fun and mastery of Jython and Java. No >real goals except bugs and a TODO list. BTW, did it work ok for you? > > > >>Are there plans to add >>in a GUI builder? >> >> > >No plans, a GUI builder would be cool but I don't have a grasp of the problem >because I've never used one. > > > >>Looks very promising. The pages at sourceforge are >>blank as far as explanations, and I'm not familiar with IDLE to know >>what to expect. >> >> > >Its shares no code with IDLE and does not attempt to clone it to any degree. >I did steal the Python colorization algorithm from IDLE. I guess the goals >are similar though, something for people to poke around with and explore >Jython and Java. > >I'd like to get it into a more releasable state soon. I'm still hung up on >the details but I would like to eventually make it a self-contiained .jar. >I'd also like some translations of the resource files into other languages. > >-Michel > > >------------------------------------------------------- >This SF.Net email is sponsored by: INetU >Attention Web Developers & Consultants: Become An INetU Hosting Partner. >Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! >INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php >_______________________________________________ >Jython-users mailing list >Jyt...@li... >https://lists.sourceforge.net/lists/listinfo/jython-users > > > |