You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(8) |
Dec
(51) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(105) |
Feb
(93) |
Mar
(194) |
Apr
(145) |
May
(100) |
Jun
(111) |
Jul
(117) |
Aug
(126) |
Sep
(233) |
Oct
(138) |
Nov
(164) |
Dec
(109) |
2002 |
Jan
(216) |
Feb
(175) |
Mar
(216) |
Apr
(194) |
May
(157) |
Jun
(140) |
Jul
(158) |
Aug
(73) |
Sep
(105) |
Oct
(164) |
Nov
(104) |
Dec
(95) |
2003 |
Jan
(72) |
Feb
(69) |
Mar
(81) |
Apr
(151) |
May
(101) |
Jun
(139) |
Jul
(99) |
Aug
(118) |
Sep
(115) |
Oct
(151) |
Nov
(161) |
Dec
(102) |
2004 |
Jan
(120) |
Feb
(175) |
Mar
(106) |
Apr
(111) |
May
(54) |
Jun
(78) |
Jul
(76) |
Aug
(105) |
Sep
(94) |
Oct
(143) |
Nov
(75) |
Dec
(85) |
2005 |
Jan
(99) |
Feb
(77) |
Mar
(164) |
Apr
(97) |
May
(79) |
Jun
(57) |
Jul
(65) |
Aug
(102) |
Sep
(95) |
Oct
(129) |
Nov
(123) |
Dec
(52) |
2006 |
Jan
(48) |
Feb
(99) |
Mar
(90) |
Apr
(51) |
May
(81) |
Jun
(136) |
Jul
(56) |
Aug
(109) |
Sep
(50) |
Oct
(44) |
Nov
(74) |
Dec
(75) |
2007 |
Jan
(92) |
Feb
(137) |
Mar
(93) |
Apr
(79) |
May
(52) |
Jun
(74) |
Jul
(143) |
Aug
(175) |
Sep
(154) |
Oct
(137) |
Nov
(88) |
Dec
(90) |
2008 |
Jan
(58) |
Feb
(113) |
Mar
(167) |
Apr
(88) |
May
(105) |
Jun
(37) |
Jul
(87) |
Aug
(72) |
Sep
(56) |
Oct
(41) |
Nov
(102) |
Dec
(70) |
2009 |
Jan
(115) |
Feb
(113) |
Mar
(126) |
Apr
(58) |
May
(125) |
Jun
(45) |
Jul
(90) |
Aug
(125) |
Sep
(84) |
Oct
(61) |
Nov
(111) |
Dec
(61) |
2010 |
Jan
(85) |
Feb
(86) |
Mar
(130) |
Apr
(58) |
May
(57) |
Jun
(32) |
Jul
(25) |
Aug
(50) |
Sep
(41) |
Oct
(65) |
Nov
(63) |
Dec
(24) |
2011 |
Jan
(43) |
Feb
(31) |
Mar
(28) |
Apr
(68) |
May
(53) |
Jun
(42) |
Jul
(58) |
Aug
(26) |
Sep
(51) |
Oct
(76) |
Nov
(60) |
Dec
(9) |
2012 |
Jan
(16) |
Feb
(32) |
Mar
(32) |
Apr
(39) |
May
(16) |
Jun
(19) |
Jul
(3) |
Aug
(11) |
Sep
(35) |
Oct
(47) |
Nov
(28) |
Dec
(18) |
2013 |
Jan
(18) |
Feb
(36) |
Mar
(10) |
Apr
(7) |
May
(7) |
Jun
(27) |
Jul
(17) |
Aug
(35) |
Sep
(19) |
Oct
(31) |
Nov
(8) |
Dec
(22) |
2014 |
Jan
(5) |
Feb
(11) |
Mar
(18) |
Apr
(23) |
May
(26) |
Jun
(14) |
Jul
(18) |
Aug
(26) |
Sep
(20) |
Oct
(48) |
Nov
(13) |
Dec
(9) |
2015 |
Jan
(9) |
Feb
(15) |
Mar
(25) |
Apr
(10) |
May
(26) |
Jun
(6) |
Jul
(13) |
Aug
(5) |
Sep
(14) |
Oct
(36) |
Nov
(24) |
Dec
(18) |
2016 |
Jan
(24) |
Feb
(11) |
Mar
(1) |
Apr
(6) |
May
(7) |
Jun
(3) |
Jul
(9) |
Aug
(15) |
Sep
(22) |
Oct
(5) |
Nov
(5) |
Dec
(2) |
2017 |
Jan
(20) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(5) |
Jun
(7) |
Jul
(14) |
Aug
(9) |
Sep
(18) |
Oct
(2) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(7) |
Feb
(6) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(18) |
Sep
(8) |
Oct
(9) |
Nov
(4) |
Dec
(6) |
2019 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(8) |
Jul
(11) |
Aug
(10) |
Sep
(6) |
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
(8) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(1) |
2021 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(5) |
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
(5) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <pi...@hu...> - 2001-04-30 16:08:18
|
Any thougts on the best way to bind events? I'm working with a form that has two text fields and a button; eventually it's going to be a login form. For the button I'm using: btnLogin = java.awt.Button("Login", actionPerformed=processLogin(txtLoginID.text, txtPasswd.txt)) When I have any type of parameters for processLogin it dies on me with (I didn't paste the entire traceback): java.lang.ArrayIndexOutOfBoundsException If I place 'actionPerformed=processLogin("test")' it prints out "test" when the program starts and does nothing when the button is pressed. When I place 'processLogin' by itself the method is invoded, however it has no way of knowing about the values in the login method (where the form is created). I have some buttons and menu items on other forms that don't need to pass parameters and they work fine. Does anyone know of a better way to pass this information? Thanks for any help, Wayne Free, encrypted, secure Web-based email at www.hushmail.com |
From: Robert W. B. <rb...@di...> - 2001-04-30 13:54:04
|
Hi Steinar, On Mon, 30 Apr 2001, Steinar Rune Eriksen wrote: > Hi > > Can anyone please give me some guidance on this. I try to create a system where I use Java classes that are subclassed for prototyping in Jython. Within the rest of the Java code (after initialization) I would like to refer to standard Java classes rather than PyObject. Hence, I try to subclass a Java class in Python and later just use the Java class itself when calling methods. > > Am I trying to do something that is not possible within the Jython framework, or is there away around it. > > Java : > class MyClass > { > void Method() > > } > > Jython : > > def PyMyClass (MyClass): > def Method() > > > Java (Factory class) > class MyClassFactory > > public MyClass createMyClass() > { > /* > use PythonInterpreter to create > PyObject instance of PyMyClass() > > This works fine. I can call methods here (with invoke) > */ > MyClass p=(MyClass) myPyObject; > // Why does this typecase fail (error on PyInstance) ? > // I thought this cast would work since the PyMyClass object subclasses MyClass... ?? > > } Try: MyClass p = PyObject.__tojava__(MyClass.class); -rb |
From: Ryan S. <FL...@FD...> - 2001-04-30 13:33:01
|
For some reason I am having problems using the PythonInterpreter class when I attempt to embed Jython. There are no errors whatsoever when I compile, but when I attempt to run it, I get this: Exception in thread "main" java.lang.NullPointerException at org.python.core.PyJavaClass.lookup(PyJavaClass.java:39) at org.python.core.PyObject.<init>(PyObject.java:46) at org.python.core.PySingleton.<init>(PySingleton.java:8) at org.python.core.PyNone.<init>(PyNone.java:7) at org.python.core.PySystemState.initStaticFields(PySystemState.java:34) at org.python.core.PySystemState.initialize(PySystemState.java:320) at org.python.core.PySystemState.initialize(PySystemState.java:294) at org.python.core.PySystemState.initialize(PySystemState.java:287) at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:61) at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:45) at SimpleEmbedded.main(SimpleEmbedded.java:6) Line 6 in SimpleEmbedded.java is where the PythonIntepreter variable is initialized. This occurred when trying to run the embed demo that comes with Jython. I am using the 1.3 SDK from Sun, and Jython-2.0. Any ideas? Thanks, -Ryan |
From: Steinar R. E. <ste...@fi...> - 2001-04-30 13:08:45
|
Hi Can anyone please give me some guidance on this. I try to create a = system where I use Java classes that are subclassed for prototyping in = Jython. Within the rest of the Java code (after initialization) I would = like to refer to standard Java classes rather than PyObject. Hence, I = try to subclass a Java class in Python and later just use the Java class = itself when calling methods. Am I trying to do something that is not possible within the Jython = framework, or is there away around it. Java : class MyClass { void Method() } Jython : def PyMyClass (MyClass): def Method() Java (Factory class) class MyClassFactory public MyClass createMyClass() { /* use PythonInterpreter to create PyObject instance of PyMyClass() =20 This works fine. I can call methods here (with invoke) */=20 MyClass p=3D(MyClass) myPyObject;=20 // Why does this typecase fail (error on PyInstance) ? // I thought this cast would work since the PyMyClass object = subclasses MyClass... ?? =20 } =20 |
From: Brian Z. <bri...@ya...> - 2001-04-29 02:43:16
|
See http://www.geocrawler.com/archives/3/7018/2001/2/50/5130868/ http://www.geocrawler.com/archives/3/7018/2001/2/50/5131034/ Regards, /Brian ----- Original Message ----- From: "Arun Sharma" <ar...@sh...> To: <jyt...@li...> Sent: Saturday, April 28, 2001 9:11 AM Subject: [Jython-users] PyServlet questions > Hi, > > I'm trying to use PyServlet along with tomcat and ran into a couple of > problems: > > (a) Is there a way to load a python servlet (init.py) on startup ? For java > servlets, I use load-on-startup=1 > (b) Python servlets get reloaded when I make changes, but other python > modules they "import" don't get reloaded when they're changed. I understand > that this is the default java behavior, but is there a way to change this > in python ? Will save me a restart, if I can do that. > > Thanks! > > -Arun > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Arun S. <ar...@sh...> - 2001-04-28 16:14:59
|
Hi, I'm trying to use PyServlet along with tomcat and ran into a couple of problems: (a) Is there a way to load a python servlet (init.py) on startup ? For java servlets, I use load-on-startup=1 (b) Python servlets get reloaded when I make changes, but other python modules they "import" don't get reloaded when they're changed. I understand that this is the default java behavior, but is there a way to change this in python ? Will save me a restart, if I can do that. Thanks! -Arun |
From: Eric F. <eri...@ny...> - 2001-04-28 11:25:38
|
is there documentation for this? --- Eric Freudenthal // Courant Institute // New York University office: 212-998-3345 // cell:917-279-6208 715 Broadway, Room 1011, New York, NY 10003 cell pager: eri...@fr... (100 char limit) -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of jyt...@li... Sent: Thursday, April 26, 2001 12:10 PM To: jyt...@li... Subject: Jython-users digest, Vol 1 #133 - 12 msgs Send Jython-users mailing list submissions to jyt...@li... To subscribe or unsubscribe via the World Wide Web, visit http://lists.sourceforge.net/lists/listinfo/jython-users or, via email, send a message with subject or body 'help' to jyt...@li... You can reach the person managing the list at jyt...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Jython-users digest..." Today's Topics: 1. Re: implementing an interface (multple inheritance) (Finn Bock) 2. Re: Jython on MacOS X? (Michael Rose) 3. Re: Jython on MacOS X? (Deirdre Saoirse Moen) 4. Re: Jython on MacOS X? (Michael Rose) 5. Re: Jython on MacOS X? (Deirdre Saoirse Moen) 6. Package cache dir (Adam Berger) 7. Re: Jython on MacOS X? (Deirdre Saoirse Moen) 8. RE: Running auto-discovered methods (Neil Benn) 9. RE: Running auto-discovered methods (brian zimmer) 10. Re: Jython on MacOS X? (Michael Rose) 11. Re: Jython on MacOS X? (Deirdre Saoirse Moen) 12. Re: Package cache dir (Robert W. Bill) --__--__-- Message: 1 From: bc...@wo... (Finn Bock) To: jyt...@li... Cc: "Eric Freudenthal" <eri...@ny...> Subject: Re: [Jython-users] implementing an interface (multple inheritance) Date: Wed, 25 Apr 2001 18:59:08 GMT [Eric Freudenthal] >I would like to integrate some jython into a java source tree. Some of my >python modules will need to import classes defined in this project, and in >at least one case, I need to implement a jython class with multiple >inheritance from a java class and a java interface. How must I do this? See other post in the thread. >Finally, are jython objects serializable? Yes, but when reading a serialized stream you must use the org.python.util.PythonObjectInputStream instead of the normal ObjectInputStream class. This utility class will help when resolving python classes that subclass java classes. regards, finn --__--__-- Message: 2 Date: Wed, 25 Apr 2001 22:29:15 +0200 From: Michael Rose <ro...@te...> To: "jyt...@li..." <jyt...@li...> Subject: Re: [Jython-users] Jython on MacOS X? --On Wednesday, April 25, 2001 10:59 AM -0700 Deirdre Saoirse Moen <de...@de...> wrote: > > > Has anyone else installed Jython on MacOS X? If so, where did you install > it? I've installed it with no problem - just follow the Unix instructions, not the MacOS instruction. You can install anywhere you want. It's handy to make a link from the jython shell script into /usr/local/bin > > b) I wanted to see if I could write Jython code that hooked up to > Interface Builder > There are a few people experimenting with this,( and some trying the same thing working on the CPython and Objective-C route). Interesting possibilities. HTH Michael --__--__-- Message: 3 Date: Wed, 25 Apr 2001 13:43:08 -0700 To: Michael Rose <ro...@te...>, jyt...@li... From: Deirdre Saoirse Moen <de...@de...> Subject: Re: [Jython-users] Jython on MacOS X? >--On Wednesday, April 25, 2001 10:59 AM -0700 Deirdre Saoirse Moen >I've installed it with no problem - just follow the Unix instructions, not >the MacOS instruction. You can install anywhere you want. It's handy to >make a link from the jython shell script into /usr/local/bin Yay. :) >> b) I wanted to see if I could write Jython code that hooked up to >> Interface Builder >> >There are a few people experimenting with this,( and some trying the same >thing working on the CPython and Objective-C route). Interesting >possibilities. I hadn't really thought about doing it this way, but it seemed that it might need a whole bunch more wrappering to do it that way, or am I wrong? I'm completely new to JPython and the only Java I know comes from Peet's.... (but I am the listmom for tu...@py..., so I know python, though I've never really mixed it with other languages) In other words, if there's an AppKit class for NSObject, and I need to add a controller subclass, I can do that directly in Jython? It seems like the CPython would require wrapping NSObject, right? Or am I missing something? -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams --__--__-- Message: 4 Date: Wed, 25 Apr 2001 22:59:17 +0200 From: Michael Rose <ro...@te...> To: Deirdre Saoirse Moen <de...@de...>, "jyt...@li..." <jyt...@li...> Subject: Re: [Jython-users] Jython on MacOS X? Deirdre writes: > I hadn't really thought about doing it this way, but it seemed that it > might need a whole bunch more wrappering to do it that way, or am I wrong? You are right. I think there's a project for this on SourceForge called PyObjC. > In other words, if there's an AppKit class for NSObject, and I need to add > a controller subclass, I can do that directly in Jython? > > It seems like the CPython would require wrapping NSObject, right? Or am I > missing something? No, you're not missing anything. You've just run into the pervasive 'Law of Conservation of Difficulty'. Java/jython integration is much easier, but Interface Builder is basically Objective-C with bridges for the Java versions of AppKit classes. I have no wise words on the best approach, but I'm also taking a fist shot at the Jython/Java way. Michael ************************************************ Assoc. Prof. Michael Rose Center for Tele-Information, Technical University of Denmark (45) 45 25 51 72 mailto:ro...@te... Off the Desktop - http://converge.cti.dtu.dk/news 'and what is the use of a computer' thought Alice 'without pictures or conversation' with apologies to Lewis Carroll ************************************************* --__--__-- Message: 5 Date: Wed, 25 Apr 2001 14:01:27 -0700 To: Michael Rose <ro...@te...>, jyt...@li... From: Deirdre Saoirse Moen <de...@de...> Subject: Re: [Jython-users] Jython on MacOS X? >Deirdre writes: > >> I hadn't really thought about doing it this way, but it seemed that it >> might need a whole bunch more wrappering to do it that way, or am I wrong? >You are right. I think there's a project for this on SourceForge called >PyObjC. Cool, thanks for the link, I hadn't known about it. >> In other words, if there's an AppKit class for NSObject, and I need to add >> a controller subclass, I can do that directly in Jython? >> >> It seems like the CPython would require wrapping NSObject, right? Or am I >> missing something? >No, you're not missing anything. You've just run into the pervasive 'Law of >Conservation of Difficulty'. Java/jython integration is much easier, but >Interface Builder is basically Objective-C with bridges for the Java >versions of AppKit classes. I have no wise words on the best approach, but >I'm also taking a fi[r]st shot at the Jython/Java way. Coolness. Well, I've been going through the Java tutorial today and I think I have the hang of it. I did some ObjC programming when RDR2 came out, but that was three years ago. Back to the project.... -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams --__--__-- Message: 6 Date: Wed, 25 Apr 2001 23:01:22 -0700 (PDT) From: Adam Berger <sir...@ya...> To: jyt...@li... Subject: [Jython-users] Package cache dir When I use a script to run Jython, and my current directory isn't Jython's home directory, I get the message: *sys-package-mgr*: can't create package cache dir, '/cachedir/packages' Jython 2.1a1 on java1.3.0 (JIT: jitc) The python.home property and classpaths are initialized correctly. What am I missing? Adam __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ --__--__-- Message: 7 Date: Thu, 26 Apr 2001 01:26:46 -0700 To: Michael Rose <ro...@te...>, jyt...@li... From: Deirdre Saoirse Moen <de...@de...> Subject: Re: [Jython-users] Jython on MacOS X? I have a few more questions..... 1) I basically want to code in python. 2) I'm confused by the examples. I understand how I can use a .py file with jython. What I'm not clear on is how I'd do that within the confines of Project Builder/Interface Builder, which calls javac. So, ultimately what I'd like is NOT to recompile python as Java (though I could I suppose) but rather write python in a way that Java is happy with. I'm obviously missing something because it's not clear to me at all, but if I could just step over this hurdle, I'd have a project.... -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams --__--__-- Message: 8 Reply-To: <nei...@ca...> From: "Neil Benn" <nei...@ca...> To: <jyt...@li...> Subject: RE: [Jython-users] Running auto-discovered methods Date: Thu, 26 Apr 2001 09:32:48 +0100 Hello, That's great, thanks for posting that message Brian, I've looked at the link you posted but I can't seem to find any information about 'walking the path' as you mentioned to discover the arguments. Would it be possible to elaborate on that point please? Much appreciated. Cheers, Neil -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of brian zimmer Sent: 21 April 2001 15:10 To: Scott Knight; jython Subject: RE: [Jython-users] Running auto-discovered methods Scott, Here's an example of what I think you are looking for (it works equally well on a [Java|Python] [class|instance]: >>> class Test: ... def go(self): ... print "invoked go" ... def went(self): ... print "invoked went" ... >>> t = Test() >>> dir(t.__class__) ['__doc__', '__module__', 'go', 'went'] >>> for a in dir(t.__class__): ... if a[0:2] <> "__": ... getattr(t, a)() ... invoked go invoked went >>> Notice the line: getattr(t, a)() The built-in 'getattr' retuns a method bound on the instance t, similar to a Method object in Java. In Java, to execute the Method, you would call: m.invoke(instance, params) in Python you use the callable nature of objects and invoke it by: m(params) since the method is already bound to the instance you don't need to pass it as a param as you do in Java since in Java the Method is always bound to the class, not an instance. For a more indepth look at when the method is bound to an instance and when to a class: >>> getattr(Test, "go") <unbound method Test.go> >>> getattr(t, "go") <method Test.go of Test instance at 3335245> >>> getattr(Test, "go")(t) invoked go >>> getattr(t, "go")() invoked go >>> Notice that when I get the method from the class, I need to pass an instance to invoke it, fulfilling the contract for sending a 'self' argument. Also note that neither go() or went() required arguments in my example. If you really want to blindly invoke methods you'll need to figure out if they require arguments. In general, the invoker knows the arguments required, such as the callback in os.path.walk(). You might want to check out this as well: http://www.diveintopython.org/apihelper_getattr.html hope this helps, brian > -----Original Message----- > From: jyt...@li... > [mailto:jyt...@li...]On Behalf Of Scott > Knight > Sent: Saturday, April 21, 2001 7:52 AM > To: jython > Subject: [Jython-users] Running auto-discovered methods > > > A few days ago, Neil Benn queried "Self Describing Scripts in Jython" > and appears to be wanting to do something similar to what I need: > something analogous to Java's Reflection. I can easily get a list of > the method names in a class. I can't figure out how to invoke the > method given it's name in string form. What I am really after is to > cycle through all of the method names in the list and run them all, > rather than type up a method that calls each of a couple hundred methods > statically. > -- > Scott Knight mailto:sc...@sc... > http://www.scottknight.com/ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users --__--__-- Message: 9 Reply-To: <bz...@zi...> From: "brian zimmer" <bz...@zi...> To: <nei...@ca...>, <jyt...@li...> Subject: RE: [Jython-users] Running auto-discovered methods Date: Thu, 26 Apr 2001 06:47:52 -0500 Neil, What I was trying to say was some functions require a number of arguments and it's not easily discerned at runtime the number or the types of those arguments unless the caller knows it ahead of time. So just blindly calling methods discovered from dir() will most likely result in a number of 'not enough arguments' errors. A number of python modules provide some sort of naming convention to handle this issue, such as xmllib when you subclass the default parser. At each start of an element in the document it looks for a method called 'start_ELEMENTNAME' to invoke with the attributes of the element. This is a documented feature and how the caller of the method knows what and how many arguments to pass. http://www.python.org/doc/current/lib/module-xmllib.html os.path.walk() is a method that walks through the filesystem path. At each directory it invokes a callable function, supplied by the user, with three argument '(args, root, files)'. Again, this is documented. If the caller didn't know the callback expected these three arguments an Error would occur. http://www.python.org/doc/current/lib/module-os.path.html I hope this clarifies things a bit. My point is if you want to invoke random methods on an instance, the general pythonic way of doing so is adopting a naming convention (such as xmllib or unittest) and only calling methods that adhere to the naming scheme. It's the simplest and safest way to know the methods you are calling expect you to be calling them. brian > -----Original Message----- > From: jyt...@li... > [mailto:jyt...@li...]On Behalf Of Neil Benn > Sent: Thursday, April 26, 2001 3:33 AM > To: jyt...@li... > Subject: RE: [Jython-users] Running auto-discovered methods > > > Hello, > > That's great, thanks for posting that message Brian, I've looked at the > link you posted but I can't seem to find any information about 'walking the > path' as you mentioned to discover the arguments. Would it be possible to > elaborate on that point please? > > Much appreciated. > > Cheers, > > Neil > > -----Original Message----- > From: jyt...@li... > [mailto:jyt...@li...]On Behalf Of brian > zimmer > Sent: 21 April 2001 15:10 > To: Scott Knight; jython > Subject: RE: [Jython-users] Running auto-discovered methods > > > Scott, > > Here's an example of what I think you are looking for (it works equally well > on a [Java|Python] [class|instance]: > > >>> class Test: > ... def go(self): > ... print "invoked go" > ... def went(self): > ... print "invoked went" > ... > >>> t = Test() > >>> dir(t.__class__) > ['__doc__', '__module__', 'go', 'went'] > >>> for a in dir(t.__class__): > ... if a[0:2] <> "__": > ... getattr(t, a)() > ... > invoked go > invoked went > >>> > > Notice the line: > > getattr(t, a)() > > The built-in 'getattr' retuns a method bound on the instance t, similar to a > Method object in Java. In Java, to execute the Method, > you would call: > > m.invoke(instance, params) > > in Python you use the callable nature of objects and invoke it by: > > m(params) > > since the method is already bound to the instance you don't need to pass it > as a param as you do in Java since in Java the Method is > always bound to the class, not an instance. > > For a more indepth look at when the method is bound to an instance and when > to a class: > > >>> getattr(Test, "go") > <unbound method Test.go> > >>> getattr(t, "go") > <method Test.go of Test instance at 3335245> > >>> getattr(Test, "go")(t) > invoked go > >>> getattr(t, "go")() > invoked go > >>> > > Notice that when I get the method from the class, I need to pass an instance > to invoke it, fulfilling the contract for sending a > 'self' argument. > > Also note that neither go() or went() required arguments in my example. If > you really want to blindly invoke methods you'll need to > figure out if they require arguments. In general, the invoker knows the > arguments required, such as the callback in os.path.walk(). > > You might want to check out this as well: > > http://www.diveintopython.org/apihelper_getattr.html > > hope this helps, > > brian > > > -----Original Message----- > > From: jyt...@li... > > [mailto:jyt...@li...]On Behalf Of Scott > > Knight > > Sent: Saturday, April 21, 2001 7:52 AM > > To: jython > > Subject: [Jython-users] Running auto-discovered methods > > > > > > A few days ago, Neil Benn queried "Self Describing Scripts in Jython" > > and appears to be wanting to do something similar to what I need: > > something analogous to Java's Reflection. I can easily get a list of > > the method names in a class. I can't figure out how to invoke the > > method given it's name in string form. What I am really after is to > > cycle through all of the method names in the list and run them all, > > rather than type up a method that calls each of a couple hundred methods > > statically. > > -- > > Scott Knight mailto:sc...@sc... > > http://www.scottknight.com/ > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users --__--__-- Message: 10 Date: Thu, 26 Apr 2001 17:22:12 +0200 From: Michael Rose <ro...@te...> To: Deirdre Saoirse Moen <de...@de...>, "jyt...@li..." <jyt...@li...> Subject: Re: [Jython-users] Jython on MacOS X? --On Thursday, April 26, 2001 1:26 AM -0700 Deirdre Saoirse Moen <de...@de...> wrote: > 2) I'm confused by the examples. I understand how I can use a .py file > with jython. What I'm not clear on is how I'd do that within the confines > of Project Builder/Interface Builder, which calls javac. PB/IB are currently 'Python Challenged' - it's not possible to actually run a .py file from inside project builder. > So, ultimately what I'd like is NOT to recompile python as Java (though I > could I suppose) but rather write python in a way that Java is happy with. > The only other thing that is possible is to use the Python Interpreter in your Java classes. In other words, Java has to be in control, but you can call Jython classes from there. It's a passable middle ground for now. Good luck Michael ************************************************ Assoc. Prof. Michael Rose Center for Tele-Information, Technical University of Denmark (45) 45 25 51 72 mailto:ro...@te... Off the Desktop - http://converge.cti.dtu.dk/news 'and what is the use of a computer' thought Alice 'without pictures or conversation' with apologies to Lewis Carroll ************************************************* --__--__-- Message: 11 Date: Thu, 26 Apr 2001 09:01:32 -0700 To: Michael Rose <ro...@te...>, jyt...@li... From: Deirdre Saoirse Moen <de...@de...> Subject: Re: [Jython-users] Jython on MacOS X? >PB/IB are currently 'Python Challenged' - it's not possible to actually run >a .py file from inside project builder. I'm aware of that. > The only other thing that is possible is to use the Python Interpreter in >your Java classes. In other words, Java has to be in control, but you can >call Jython classes from there. It's a passable middle ground for now. Are you saying it would have to be like the embedded example (as in http://www.jython.org/docs/embedding.html )? Because that's really ugly imho. Or is there a way to get the headers right so that one can simply subclass (as in http://www.jython.org/docs/subclassing.html )? Because if there is, I don't quite understand what to put at the top. Sorry to be dense, but I'm dealing with too many variables to make me happy. :) -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams --__--__-- Message: 12 Date: Thu, 26 Apr 2001 16:03:46 -0500 (CDT) From: "Robert W. Bill" <rb...@di...> To: Adam Berger <sir...@ya...> cc: <jyt...@li...> Subject: Re: [Jython-users] Package cache dir Hello Adam, On Wed, 25 Apr 2001, Adam Berger wrote: > When I use a script to run Jython, and my current > directory isn't Jython's home directory, I get the > message: > > *sys-package-mgr*: can't create package cache dir, > '/cachedir/packages' > Jython 2.1a1 on java1.3.0 (JIT: jitc) This is usually the result of permission problems. A mkdir cachedir; chmod a+rw cachedir in the Jython directory should fix it. > The python.home property and classpaths are > initialized correctly. What am I missing? The value of python.home is where you should add and chmod the cachedir. Cheers, Robert --__--__-- _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users End of Jython-users Digest |
From: brian z. <bz...@zi...> - 2001-04-27 13:28:51
|
At 08:34 AM 4/27/2001 -0400, Ron...@Ne... wrote: >I have modules A--> D. > >Module A imports modules B, C. >Module D imports module A, and it uses modules B and C. > >Module D has runtime errors because the interpreter says it doesn't >recognize B or C >inside module D - yet I imported module A, which imported B and C. > >So, it appears that all modules require explicit import statements. This is true. Unlike C/C++ header files, the module imports reside only in the module namespace in which they are imported. So for D to make use of B and C, you'll need to import both of them. Now it is possible from within D to use module B by calling D.A.B but this is not really recommended since you won't know if the module ever changes its import statements with any confidence other than an AttributeError. However it does show how you can get at imports bound in different namespaces just as you would an attribute of any other object. -- A.py -- import B, C def hi(): print "A says hi" -- B.py -- def hi(): print "B says hi" -- C.py -- def hi(): print "C says hi" -- D.py -- import A def hi(): print "D says hi" >>> import D >>> D.A.B.hi() B says hi >>> >Maybe this means I haven't used Java >enough? Quite possibly, stick to Python, it's better! ;) brian |
From: <Ron...@Ne...> - 2001-04-27 12:36:10
|
I have modules A--> D. Module A imports modules B, C. Module D imports module A, and it uses modules B and C. Module D has runtime errors because the interpreter says it doesn't recognize B or C inside module D - yet I imported module A, which imported B and C. So, it appears that all modules require explicit import statements. I'd love some human to elaborate; I guess I was expecting a behavior similar to including header files in C/C++. Maybe this means I haven't used Java enough? |
From: Pasha A. <par...@en...> - 2001-04-26 17:01:56
|
I understande that the regex API got converted to the re, however a function that I need wasn't ported over, that would be the get_syntax method. I need to know another way to implment or an alternate method I could use so I can call if from jython. Thanks! ____________________________ Pasha Arshadi Software Engineer Endeavors Technology 19700 Fairchild, Suite 200 Irvine, CA 92612 (949) 833-2800 x110 www.endeavors.com par...@en... |
From: Robert W. B. <rb...@di...> - 2001-04-26 16:08:03
|
Hello Adam, On Wed, 25 Apr 2001, Adam Berger wrote: > When I use a script to run Jython, and my current > directory isn't Jython's home directory, I get the > message: > > *sys-package-mgr*: can't create package cache dir, > '/cachedir/packages' > Jython 2.1a1 on java1.3.0 (JIT: jitc) This is usually the result of permission problems. A mkdir cachedir; chmod a+rw cachedir in the Jython directory should fix it. > The python.home property and classpaths are > initialized correctly. What am I missing? The value of python.home is where you should add and chmod the cachedir. Cheers, Robert |
From: Deirdre S. M. <de...@de...> - 2001-04-26 16:01:48
|
>PB/IB are currently 'Python Challenged' - it's not possible to actually run >a .py file from inside project builder. I'm aware of that. > The only other thing that is possible is to use the Python Interpreter in >your Java classes. In other words, Java has to be in control, but you can >call Jython classes from there. It's a passable middle ground for now. Are you saying it would have to be like the embedded example (as in http://www.jython.org/docs/embedding.html )? Because that's really ugly imho. Or is there a way to get the headers right so that one can simply subclass (as in http://www.jython.org/docs/subclassing.html )? Because if there is, I don't quite understand what to put at the top. Sorry to be dense, but I'm dealing with too many variables to make me happy. :) -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Michael R. <ro...@te...> - 2001-04-26 15:21:47
|
--On Thursday, April 26, 2001 1:26 AM -0700 Deirdre Saoirse Moen <de...@de...> wrote: > 2) I'm confused by the examples. I understand how I can use a .py file > with jython. What I'm not clear on is how I'd do that within the confines > of Project Builder/Interface Builder, which calls javac. PB/IB are currently 'Python Challenged' - it's not possible to actually run a .py file from inside project builder. > So, ultimately what I'd like is NOT to recompile python as Java (though I > could I suppose) but rather write python in a way that Java is happy with. > The only other thing that is possible is to use the Python Interpreter in your Java classes. In other words, Java has to be in control, but you can call Jython classes from there. It's a passable middle ground for now. Good luck Michael ************************************************ Assoc. Prof. Michael Rose Center for Tele-Information, Technical University of Denmark (45) 45 25 51 72 mailto:ro...@te... Off the Desktop - http://converge.cti.dtu.dk/news 'and what is the use of a computer' thought Alice 'without pictures or conversation' with apologies to Lewis Carroll ************************************************* |
From: brian z. <bz...@zi...> - 2001-04-26 11:52:47
|
Neil, What I was trying to say was some functions require a number of arguments and it's not easily discerned at runtime the number or the types of those arguments unless the caller knows it ahead of time. So just blindly calling methods discovered from dir() will most likely result in a number of 'not enough arguments' errors. A number of python modules provide some sort of naming convention to handle this issue, such as xmllib when you subclass the default parser. At each start of an element in the document it looks for a method called 'start_ELEMENTNAME' to invoke with the attributes of the element. This is a documented feature and how the caller of the method knows what and how many arguments to pass. http://www.python.org/doc/current/lib/module-xmllib.html os.path.walk() is a method that walks through the filesystem path. At each directory it invokes a callable function, supplied by the user, with three argument '(args, root, files)'. Again, this is documented. If the caller didn't know the callback expected these three arguments an Error would occur. http://www.python.org/doc/current/lib/module-os.path.html I hope this clarifies things a bit. My point is if you want to invoke random methods on an instance, the general pythonic way of doing so is adopting a naming convention (such as xmllib or unittest) and only calling methods that adhere to the naming scheme. It's the simplest and safest way to know the methods you are calling expect you to be calling them. brian > -----Original Message----- > From: jyt...@li... > [mailto:jyt...@li...]On Behalf Of Neil Benn > Sent: Thursday, April 26, 2001 3:33 AM > To: jyt...@li... > Subject: RE: [Jython-users] Running auto-discovered methods > > > Hello, > > That's great, thanks for posting that message Brian, I've looked at the > link you posted but I can't seem to find any information about 'walking the > path' as you mentioned to discover the arguments. Would it be possible to > elaborate on that point please? > > Much appreciated. > > Cheers, > > Neil > > -----Original Message----- > From: jyt...@li... > [mailto:jyt...@li...]On Behalf Of brian > zimmer > Sent: 21 April 2001 15:10 > To: Scott Knight; jython > Subject: RE: [Jython-users] Running auto-discovered methods > > > Scott, > > Here's an example of what I think you are looking for (it works equally well > on a [Java|Python] [class|instance]: > > >>> class Test: > ... def go(self): > ... print "invoked go" > ... def went(self): > ... print "invoked went" > ... > >>> t = Test() > >>> dir(t.__class__) > ['__doc__', '__module__', 'go', 'went'] > >>> for a in dir(t.__class__): > ... if a[0:2] <> "__": > ... getattr(t, a)() > ... > invoked go > invoked went > >>> > > Notice the line: > > getattr(t, a)() > > The built-in 'getattr' retuns a method bound on the instance t, similar to a > Method object in Java. In Java, to execute the Method, > you would call: > > m.invoke(instance, params) > > in Python you use the callable nature of objects and invoke it by: > > m(params) > > since the method is already bound to the instance you don't need to pass it > as a param as you do in Java since in Java the Method is > always bound to the class, not an instance. > > For a more indepth look at when the method is bound to an instance and when > to a class: > > >>> getattr(Test, "go") > <unbound method Test.go> > >>> getattr(t, "go") > <method Test.go of Test instance at 3335245> > >>> getattr(Test, "go")(t) > invoked go > >>> getattr(t, "go")() > invoked go > >>> > > Notice that when I get the method from the class, I need to pass an instance > to invoke it, fulfilling the contract for sending a > 'self' argument. > > Also note that neither go() or went() required arguments in my example. If > you really want to blindly invoke methods you'll need to > figure out if they require arguments. In general, the invoker knows the > arguments required, such as the callback in os.path.walk(). > > You might want to check out this as well: > > http://www.diveintopython.org/apihelper_getattr.html > > hope this helps, > > brian > > > -----Original Message----- > > From: jyt...@li... > > [mailto:jyt...@li...]On Behalf Of Scott > > Knight > > Sent: Saturday, April 21, 2001 7:52 AM > > To: jython > > Subject: [Jython-users] Running auto-discovered methods > > > > > > A few days ago, Neil Benn queried "Self Describing Scripts in Jython" > > and appears to be wanting to do something similar to what I need: > > something analogous to Java's Reflection. I can easily get a list of > > the method names in a class. I can't figure out how to invoke the > > method given it's name in string form. What I am really after is to > > cycle through all of the method names in the list and run them all, > > rather than type up a method that calls each of a couple hundred methods > > statically. > > -- > > Scott Knight mailto:sc...@sc... > > http://www.scottknight.com/ > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Neil B. <nei...@ca...> - 2001-04-26 08:34:31
|
Hello, That's great, thanks for posting that message Brian, I've looked at the link you posted but I can't seem to find any information about 'walking the path' as you mentioned to discover the arguments. Would it be possible to elaborate on that point please? Much appreciated. Cheers, Neil -----Original Message----- From: jyt...@li... [mailto:jyt...@li...]On Behalf Of brian zimmer Sent: 21 April 2001 15:10 To: Scott Knight; jython Subject: RE: [Jython-users] Running auto-discovered methods Scott, Here's an example of what I think you are looking for (it works equally well on a [Java|Python] [class|instance]: >>> class Test: ... def go(self): ... print "invoked go" ... def went(self): ... print "invoked went" ... >>> t = Test() >>> dir(t.__class__) ['__doc__', '__module__', 'go', 'went'] >>> for a in dir(t.__class__): ... if a[0:2] <> "__": ... getattr(t, a)() ... invoked go invoked went >>> Notice the line: getattr(t, a)() The built-in 'getattr' retuns a method bound on the instance t, similar to a Method object in Java. In Java, to execute the Method, you would call: m.invoke(instance, params) in Python you use the callable nature of objects and invoke it by: m(params) since the method is already bound to the instance you don't need to pass it as a param as you do in Java since in Java the Method is always bound to the class, not an instance. For a more indepth look at when the method is bound to an instance and when to a class: >>> getattr(Test, "go") <unbound method Test.go> >>> getattr(t, "go") <method Test.go of Test instance at 3335245> >>> getattr(Test, "go")(t) invoked go >>> getattr(t, "go")() invoked go >>> Notice that when I get the method from the class, I need to pass an instance to invoke it, fulfilling the contract for sending a 'self' argument. Also note that neither go() or went() required arguments in my example. If you really want to blindly invoke methods you'll need to figure out if they require arguments. In general, the invoker knows the arguments required, such as the callback in os.path.walk(). You might want to check out this as well: http://www.diveintopython.org/apihelper_getattr.html hope this helps, brian > -----Original Message----- > From: jyt...@li... > [mailto:jyt...@li...]On Behalf Of Scott > Knight > Sent: Saturday, April 21, 2001 7:52 AM > To: jython > Subject: [Jython-users] Running auto-discovered methods > > > A few days ago, Neil Benn queried "Self Describing Scripts in Jython" > and appears to be wanting to do something similar to what I need: > something analogous to Java's Reflection. I can easily get a list of > the method names in a class. I can't figure out how to invoke the > method given it's name in string form. What I am really after is to > cycle through all of the method names in the list and run them all, > rather than type up a method that calls each of a couple hundred methods > statically. > -- > Scott Knight mailto:sc...@sc... > http://www.scottknight.com/ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Deirdre S. M. <de...@de...> - 2001-04-26 08:27:00
|
I have a few more questions..... 1) I basically want to code in python. 2) I'm confused by the examples. I understand how I can use a .py file with jython. What I'm not clear on is how I'd do that within the confines of Project Builder/Interface Builder, which calls javac. So, ultimately what I'd like is NOT to recompile python as Java (though I could I suppose) but rather write python in a way that Java is happy with. I'm obviously missing something because it's not clear to me at all, but if I could just step over this hurdle, I'd have a project.... -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Adam B. <sir...@ya...> - 2001-04-26 06:01:23
|
When I use a script to run Jython, and my current directory isn't Jython's home directory, I get the message: *sys-package-mgr*: can't create package cache dir, '/cachedir/packages' Jython 2.1a1 on java1.3.0 (JIT: jitc) The python.home property and classpaths are initialized correctly. What am I missing? Adam __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ |
From: Deirdre S. M. <de...@de...> - 2001-04-25 21:02:17
|
>Deirdre writes: > >> I hadn't really thought about doing it this way, but it seemed that it >> might need a whole bunch more wrappering to do it that way, or am I wrong? >You are right. I think there's a project for this on SourceForge called >PyObjC. Cool, thanks for the link, I hadn't known about it. >> In other words, if there's an AppKit class for NSObject, and I need to add >> a controller subclass, I can do that directly in Jython? >> >> It seems like the CPython would require wrapping NSObject, right? Or am I >> missing something? >No, you're not missing anything. You've just run into the pervasive 'Law of >Conservation of Difficulty'. Java/jython integration is much easier, but >Interface Builder is basically Objective-C with bridges for the Java >versions of AppKit classes. I have no wise words on the best approach, but >I'm also taking a fi[r]st shot at the Jython/Java way. Coolness. Well, I've been going through the Java tutorial today and I think I have the hang of it. I did some ObjC programming when RDR2 came out, but that was three years ago. Back to the project.... -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Michael R. <ro...@te...> - 2001-04-25 20:58:49
|
Deirdre writes: > I hadn't really thought about doing it this way, but it seemed that it > might need a whole bunch more wrappering to do it that way, or am I wrong? You are right. I think there's a project for this on SourceForge called PyObjC. > In other words, if there's an AppKit class for NSObject, and I need to add > a controller subclass, I can do that directly in Jython? > > It seems like the CPython would require wrapping NSObject, right? Or am I > missing something? No, you're not missing anything. You've just run into the pervasive 'Law of Conservation of Difficulty'. Java/jython integration is much easier, but Interface Builder is basically Objective-C with bridges for the Java versions of AppKit classes. I have no wise words on the best approach, but I'm also taking a fist shot at the Jython/Java way. Michael ************************************************ Assoc. Prof. Michael Rose Center for Tele-Information, Technical University of Denmark (45) 45 25 51 72 mailto:ro...@te... Off the Desktop - http://converge.cti.dtu.dk/news 'and what is the use of a computer' thought Alice 'without pictures or conversation' with apologies to Lewis Carroll ************************************************* |
From: Deirdre S. M. <de...@de...> - 2001-04-25 20:43:19
|
>--On Wednesday, April 25, 2001 10:59 AM -0700 Deirdre Saoirse Moen >I've installed it with no problem - just follow the Unix instructions, not >the MacOS instruction. You can install anywhere you want. It's handy to >make a link from the jython shell script into /usr/local/bin Yay. :) >> b) I wanted to see if I could write Jython code that hooked up to >> Interface Builder >> >There are a few people experimenting with this,( and some trying the same >thing working on the CPython and Objective-C route). Interesting >possibilities. I hadn't really thought about doing it this way, but it seemed that it might need a whole bunch more wrappering to do it that way, or am I wrong? I'm completely new to JPython and the only Java I know comes from Peet's.... (but I am the listmom for tu...@py..., so I know python, though I've never really mixed it with other languages) In other words, if there's an AppKit class for NSObject, and I need to add a controller subclass, I can do that directly in Jython? It seems like the CPython would require wrapping NSObject, right? Or am I missing something? -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams |
From: Michael R. <ro...@te...> - 2001-04-25 20:28:49
|
--On Wednesday, April 25, 2001 10:59 AM -0700 Deirdre Saoirse Moen <de...@de...> wrote: > > > Has anyone else installed Jython on MacOS X? If so, where did you install > it? I've installed it with no problem - just follow the Unix instructions, not the MacOS instruction. You can install anywhere you want. It's handy to make a link from the jython shell script into /usr/local/bin > > b) I wanted to see if I could write Jython code that hooked up to > Interface Builder > There are a few people experimenting with this,( and some trying the same thing working on the CPython and Objective-C route). Interesting possibilities. HTH Michael |
From: <bc...@wo...> - 2001-04-25 19:02:16
|
[Eric Freudenthal] >I would like to integrate some jython into a java source tree. Some of my >python modules will need to import classes defined in this project, and in >at least one case, I need to implement a jython class with multiple >inheritance from a java class and a java interface. How must I do this? See other post in the thread. >Finally, are jython objects serializable? Yes, but when reading a serialized stream you must use the org.python.util.PythonObjectInputStream instead of the normal ObjectInputStream class. This utility class will help when resolving python classes that subclass java classes. regards, finn |
From: <bc...@wo...> - 2001-04-25 18:58:38
|
On Wed, 25 Apr 2001 20:30:50 +0100, you wrote: >Eric, > >>I would like to integrate some jython into a java source tree. Some of my >>python modules will need to import classes defined in this project, and in >>at least one case, I need to implement a jython class with multiple >>inheritance from a java class and a java interface. How must I do this? > >Look under 'Interacting with java packages' at: >http://jython.sourceforge.net/docs/index.html > >You cannot directly use multiple inheritance from java classes or >interfaces. The workaround is to wrap the java things in Jython first: > >import pack1 # java packages on the class path when invoking jython. >import pack2 > >class wrapintf(pack1.someJavaInterface): > pass > # I don't know whether you actually have to implement the interface here. > >class wrapcls(pack2.someJavaClass): > pass > >class whatYouAskedFor(wrapcls, wrapintf): > pass You don't have to wrap the java classes/interfaces: class whatYouAskedFor(pack2.someJavaClass, pack1.someJavaInterface): def interface_method1(self): pass def interface_method2(self): pass will work as well. regards, finn |
From: <bc...@wo...> - 2001-04-25 18:51:24
|
[Paolo Tortora] >I followed your istruction and I create a registry file where set up some >properties. > >How can I add (and not substitute!) an extra path. >In other words? > >In jyhton script I do: >/usr/j2se/jre/bin/java -Dpython.home=${HOME}/.jythonhome -Dpython.path >=/export/skel/omc-user/pythonmodules > >And in $HOME/.jythonhome/registry I wrote the following: >python.path=mylocaldir > >In this way I just substitute the path. Right. >I would like to know how to add mylocaldir to that is set in command line. >Anyone knows how to do that ? You can't by just using property files or commandlines arguments (actual you can but you will most likely not get a useful precedence. Se property "python.prepath" for details http://www.jython.org/cgi-bin/faqw.py?req=show&file=faq02.003.htp ). Instead I would suggest that you control the final sys.path from within your python program with something like: import sys, java sys.path.append(java.System.getProperty("mylocaldir.path")) regards, finn |
From: Ype K. <yk...@xs...> - 2001-04-25 18:31:46
|
Eric, >I would like to integrate some jython into a java source tree. Some of my >python modules will need to import classes defined in this project, and in >at least one case, I need to implement a jython class with multiple >inheritance from a java class and a java interface. How must I do this? Look under 'Interacting with java packages' at: http://jython.sourceforge.net/docs/index.html You cannot directly use multiple inheritance from java classes or interfaces. The workaround is to wrap the java things in Jython first: import pack1 # java packages on the class path when invoking jython. import pack2 class wrapintf(pack1.someJavaInterface): pass # I don't know whether you actually have to implement the interface here. class wrapcls(pack2.someJavaClass): pass class whatYouAskedFor(wrapcls, wrapintf): pass Off course you can add features to the wrappers before inheriting from them. >Finally, are jython objects serializable? I have never done this, but there is a pickle module as in CPython, iirc. In case you need Java serialisation: i don't know. > >A demo sourcetree of a trival hybrid jython & java program would be VERY >helpful. Have a look at Treedemo.py and Console.py in Demos/swing in the jython distribution. Definitely worth a look for everyone who ever used swing. Good luck, Ype |