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: <bc...@wo...> - 2001-11-09 16:22:03
|
[dman] >Could someone please explain to me, again, why jython munges streams >after the fashion of ms windows if binary mode isn't specified? First, was the problem the CR-NL munging or the non-ascii munging <wink>? I assume you are running unix so it must have been be the non-ascii munging that bit you. The basic issue is how to deal with characters (16-bits) vs. bytes (8-bit). Java have two ways: Stream and Reader, but python only have one open() method. I decided to override the 'b' flag for this behavior because many (windows) programmers would already know about the 'b' flag on the open() function. By re-using the 'b' flag the default text mode was obvious because that is what windows uses. >I just had a real (annoying) waste of time tracking down why imaplib >would throw an unexpected response exception Have you forgotton how JPython-1.1 did this? Data was written as a through a Writer but reading data was through a InputStream. With no way of changing that behaviour. What we have now is better by far. >(on all correct >responses, except UID responses), but worked beautifully with cpython. >I am now submitting the patch below to cpython on sourceforge (that's >where the module is maintained, right? I know that the debian package >uses cpython's modules). It seems like this changes was submitted already: >http://sourceforge.net/tracker/?group_id=5470&atid=305470&func=detail&aid=469910 I'll apply the same patch to jython's version of imaplib.py in the next release. regards, finn |
From: <bc...@wo...> - 2001-11-09 15:35:50
|
[John Goerzen] >Hi, > >Today I tried to use jythonc to compile some code that subclassed one >of my own Java classes. This was code that was supposed to be called >by Java. > >jythonc refused to recognize that this class was a subclass of the >Java one, repeatedly. Finally I tried saying it was a subclass of >java.lang.Date -- voila -- it worked. So I tried to find out why. > >Apparently, the problem was that one of the classes that the base >class needed was not on the CLASSPATH. jythonc did not so much as >even issue a warning when it should have issued an error. It took me >hours to track this down rather than 5 minutes it should have. >Running the script with jython finally made the error clear right >away. > >Can we get some error checking in jythonc? This is actually by design. Maybe it was a bad design, but it is not a bug. jythonc also support a mode where the python sources are compiled but the proxy classes is created at runtime when needed. So if a superclass cannot be found at compile time, we just wait and see if it is available at runtime instead and then create the proxy dynamicly. The trick to happy use of jythonc is *ALWAYS* to look in the output for lines likes: Creating .java files: MyApplet extends java.applet.Applet regards, finn |
From: <bc...@wo...> - 2001-11-09 15:11:19
|
[John Goerzen] >bc...@wo... (Finn Bock) writes: > >> Try calling >> >> Py.getSystemState().setClassLoader(this.getClass().getClassLoader()); >> >> It will effectively disable attempts to import java classes from >> sys.path and instead only try to load them from the MultiClassLoader. > >Almost there!! > >(Thanks to you and Jeff Emanuel for all your help). > >I have thinks WORKING! but only if I use Jeff's trick of: >interp.set("ListBO", this.getClass()). If I try to >"import quovix" or "from quovix.business.util import ListBO" from >Python after setting the classloader per your instructions, Python >gives an "ImportError: no module named quovix". That is because java have no solid way of querying a classloader about which java packages it can serve. To load a java package from from sys.path, we have to do a directory listning to discover the available java directories. When disabling java loading from sys.path (by setting the classloader) we also disable this method of java package discovery. Take another look at the PyServlet example: > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jython/jython/org/python/util/PyServlet.java?annotate=1.11#73 and notice the calls to sys.add_package(..) and sys.add_classdir(..). These calls will give some hints to the package manager that one of the custom classloaders in the environment is able to serve additional java packages. It is important to know that the sys.add_XXX() methods does not enable loading of java classes from these sources. The methods only allow loading of java packages. >Oddly, it can import things like java.util.Date. Not odd at all. Jython scans the rt.jar file for all java classes and build a list of available java package from this list. >I'm unsure why it can't find my own >classes -- obviously the MultiClassLoader can because all this stuff >is being called from ListBO itself. So it's a bit strange. But I can >work around that certainly. > >Also I'm curious why this works: > >interp.exec("import ListBOFoo"); >Class pclass = (Class) interp.eval("ListBOFoo.ListBOFoo").__tojava__(Class.class); > >But this doesn't: > >interp.exec("mod = __import__('ListBOFoo')"); >Class pclass = (Class) interp.eval("mod.ListBOFoo").__tojava__(Class.class); > >The second dies on the eval claiming that there is no such symbol in >Python. Not a biggie but a weird thing anyway. Which symbol? Do you have a stacktrace? >Thanks for all your help! You's welcome. regards, finn |
From: John G. <jgo...@co...> - 2001-11-09 14:44:53
|
bc...@wo... (Finn Bock) writes: > Try calling > > Py.getSystemState().setClassLoader(this.getClass().getClassLoader()); > > It will effectively disable attempts to import java classes from > sys.path and instead only try to load them from the MultiClassLoader. Almost there!! (Thanks to you and Jeff Emanuel for all your help). I have thinks WORKING! but only if I use Jeff's trick of: interp.set("ListBO", this.getClass()). If I try to "import quovix" or "from quovix.business.util import ListBO" from Python after setting the classloader per your instructions, Python gives an "ImportError: no module named quovix". Oddly, it can import things like java.util.Date. I'm unsure why it can't find my own classes -- obviously the MultiClassLoader can because all this stuff is being called from ListBO itself. So it's a bit strange. But I can work around that certainly. Also I'm curious why this works: interp.exec("import ListBOFoo"); Class pclass = (Class) interp.eval("ListBOFoo.ListBOFoo").__tojava__(Class.class); But this doesn't: interp.exec("mod = __import__('ListBOFoo')"); Class pclass = (Class) interp.eval("mod.ListBOFoo").__tojava__(Class.class); The second dies on the eval claiming that there is no such symbol in Python. Not a biggie but a weird thing anyway. Thanks for all your help! -- John |
From: <bc...@wo...> - 2001-11-09 14:35:38
|
[John Goerzen] >Is it possible to tell Jython where to create the .class files that it >generates on the fly? Try the option python.options.proxyDebugDirectory=d:\\temp\\myproxies Added to your ~/.jython file or the registry file or specified in the properties to the PythonInterpreter.initialize(...) method or specified as system properties on the commandline when starting java. Which to use depends on your environment. When embedding, I suggest the initialize(..) argument way, as in >http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jython/jython/org/python/util/PyServlet.java?annotate=1.11#73 regards, finn |
From: John G. <jgo...@co...> - 2001-11-09 14:16:11
|
bc...@wo... (Finn Bock) writes: > That is because the BytecodeLoaders happens to search the > SyspathJavaLoader before searching the referent class loaders. It's a > bug. [snip] > Try calling > > Py.getSystemState().setClassLoader(this.getClass().getClassLoader()); > > It will effectively disable attempts to import java classes from > sys.path and instead only try to load them from the MultiClassLoader. Hmm. It didn't work. (I tried setting it both before and after instantiating my PythonInterpreter object in Java; didn't work either way). Interesting data points: * In Python, I printed: print Py.getSystemState().getClassLoader().getClass().getName() result: com.lutris.classloader.MultiClassLoader which is correct. * Java still claims that the loader for the base class of my Python class is sun.misc.Launcher$AppClassLoader. I at least have it -- through MANY hacks -- showing the correct loader. * I just noticed that, somewhere along the line, Java shows the superclass of my ListBOFoo as being PyFunctionTable. Eep! I don't quite know where that changed from ListBO. Somewhere in my testing I guess. Sigh. Also: Is it possible to tell Jython where to create the .class files that it generates on the fly? -- John > > >Also: I'm now pulling the *class* from python to Java, not an instance of it. > >That seems to help, maybe... > > Nah. > > regards, > finn -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: <bc...@wo...> - 2001-11-08 22:28:53
|
[John Goerzen] >Tried, still didn't help.. > >Of note: when I print the loader of ListBO from within Python, it says >com.lutris.classloader.MultiClassLoader. When I print the loader of >the superclass of ListBOFoo from within Java (that superclass is the >same ListBO), it says sun.misc.Launcher$AppClassLoader! More and more >puzzling. That is because the BytecodeLoaders happens to search the SyspathJavaLoader before searching the referent class loaders. It's a bug. > I feel that I'm SO CLOSE! Try calling Py.getSystemState().setClassLoader(this.getClass().getClassLoader()); It will effectively disable attempts to import java classes from sys.path and instead only try to load them from the MultiClassLoader. >Also: I'm now pulling the *class* from python to Java, not an instance of it. >That seems to help, maybe... Nah. regards, finn |
From: Carlos Q. <car...@we...> - 2001-11-08 22:20:06
|
Hi I'm releasing a new beta of the JythonInterpreter plugin for jEdit This release contains a few bug fixes and the error button is now capable of looking into jar files if you have the archive plugin. The final 0.6 version will be released out of this when bugs are solved and the documentation updated As in the previous beta, install first the version 0.5 and then replace the JythonInterpreter.jar with the one at http://koti.welho.com/cquiroz/jedit/jython/JythonInterpreter.jar Regards Carlos Quiroz |
From: John G. <jgo...@co...> - 2001-11-08 21:54:32
|
Tried, still didn't help.. Of note: when I print the loader of ListBO from within Python, it says com.lutris.classloader.MultiClassLoader. When I print the loader of the superclass of ListBOFoo from within Java (that superclass is the same ListBO), it says sun.misc.Launcher$AppClassLoader! More and more puzzling. I feel that I'm SO CLOSE! Also: I'm now pulling the *class* from python to Java, not an instance of it. That seems to help, maybe... -- John Jeff Emanuel <je...@ad...> writes: > I tried replicating what you are doing with a little stand-alone > java program, but I can't seem to get the conversion to fail. > > Here's another hack you could try. Instead of passing the > classloader to the script, pass the superclass. > > > Java:I p > interp.set("ListBO", this.getClass()); > > Python: > > # Omit import, ListBO is in namespace from above. > > class ListBOFoo(ListBO): # etc... > > > John Goerzen wrote: > > > Jeff Emanuel <je...@ad...> writes: > > > > >>This seems a little more familiar since you are loading the java > >>class with a custom class loader. When this has worked for me > >>before, I have always used the system default class loader. > >> > > Oddly enough, I didn't even realize that class loaders even existed > > > until your message yesterday, and certainly not that a non-default > > loader was already being used. Alas, I fear that I have no control > > over what loader is being used at the moment. > > > > >>Try finding the classloader for the superclass, as jython sees it. > >>Something like this: > >> > > I tried this, just from Python at the top of the module: > > > print "Superclass loader: " + > > ListBO.getClassLoader().getClass().getName() > > > Prior to your suggested hack below, this printed out > > > org.python.core.SyspathJavaLoader. > > > > >>I suspect that the jython super is not loaded by the same classloader and > >> > > This is true... > > > > > >>that is the root of your problems. I'm not sure if there is a way to > >> > > ... but it doesn't seem to be the root of my problems. > > > > > >>You might be able to set your custom classloader in the interpreter's > >>name space and rewrite your scripts to use that. Something like this: > >> > > [ snip ] > > > I had to hack it to get the variable into the module, but I got it to > > > do that. > > > > >> ListBO=classloader.loadClass("quovix.business.util.ListBO") > >> > > Now, the above print displays com.lutris.classloader.MultiClassLoader > > > -- the same as for my code in static Java. But -- I still get the > > same ClassCastException in Java as before -- probably because the > > ListBOFoo object is still being loaded by Python's loader (ByteLoader1). > > -- John > > > _______________________________________________ > > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users > > > > > -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: Jeff E. <je...@ad...> - 2001-11-08 21:40:52
|
I tried replicating what you are doing with a little stand-alone java program, but I can't seem to get the conversion to fail. Here's another hack you could try. Instead of passing the classloader to the script, pass the superclass. Java: interp.set("ListBO", this.getClass()); Python: # Omit import, ListBO is in namespace from above. class ListBOFoo(ListBO): # etc... John Goerzen wrote: > Jeff Emanuel <je...@ad...> writes: > > >>This seems a little more familiar since you are loading the java >>class with a custom class loader. When this has worked for me >>before, I have always used the system default class loader. >> > > Oddly enough, I didn't even realize that class loaders even existed > until your message yesterday, and certainly not that a non-default > loader was already being used. Alas, I fear that I have no control > over what loader is being used at the moment. > > >>Try finding the classloader for the superclass, as jython sees it. >>Something like this: >> > > I tried this, just from Python at the top of the module: > > print "Superclass loader: " + ListBO.getClassLoader().getClass().getName() > > Prior to your suggested hack below, this printed out > org.python.core.SyspathJavaLoader. > > >>I suspect that the jython super is not loaded by the same classloader and >> > > This is true... > > >>that is the root of your problems. I'm not sure if there is a way to >> > > ... but it doesn't seem to be the root of my problems. > > >>You might be able to set your custom classloader in the interpreter's >>name space and rewrite your scripts to use that. Something like this: >> > > [ snip ] > > I had to hack it to get the variable into the module, but I got it to > do that. > > >> ListBO=classloader.loadClass("quovix.business.util.ListBO") >> > > Now, the above print displays com.lutris.classloader.MultiClassLoader > -- the same as for my code in static Java. But -- I still get the > same ClassCastException in Java as before -- probably because the > ListBOFoo object is still being loaded by Python's loader (ByteLoader1). > > > -- John > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: John G. <jgo...@co...> - 2001-11-08 19:19:28
|
bc...@wo... (Finn Bock) writes: > The return value from PythonInterpreter.get() is always a PyObject > instance. You need to explicit convert the returned PyObject instance to > an instance of your java class like this: There are two PythonInterpeter.get() methods; one of which takes two parameters (the second the Java class to convert to) and returns a java.lang.Object. It is my understanding that this is equivolent to the code you showed. I was using this one, and got the mentioned error. > > Object tmp = interp.get("cl").__tojava__(ListBO.class); > if (tmp != Py.NoConversion) { > ListBO newobj = (ListBO) tmp; > } > > If the "cl" variable can't be converted to a ListBO, the constant value > of Py.NoConversion is returned. > > regards, > finn -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: <bc...@wo...> - 2001-11-08 19:10:19
|
[John Goerzen] >And as an additional data point: > >If I request an object of type java.lang.Object from get(), get() >works. What's more, newobj.getClass().getSuperclass().getName() >returns quovix.business.util.ListBO! However, casting newobj from >Object to ListBO fails with a java.lang.ClassCastException on >ListBOFoo$ListBOFoo$0! I'm rather mystified now. The return value from PythonInterpreter.get() is always a PyObject instance. You need to explicit convert the returned PyObject instance to an instance of your java class like this: Object tmp = interp.get("cl").__tojava__(ListBO.class); if (tmp != Py.NoConversion) { ListBO newobj = (ListBO) tmp; } If the "cl" variable can't be converted to a ListBO, the constant value of Py.NoConversion is returned. regards, finn |
From: John G. <jgo...@co...> - 2001-11-08 17:18:08
|
Hmm, why are you putting the word "quote" into sendcmd? That's not part of the protocol; it's just what some clients use to let you send something verbatim to the remote... -- John Erik Forsberg <for...@ce...> writes: > Hubert Yoshizaki <yos...@da...> writes: > > > ftpConnection.sendcmd('quote guardian') > > ftpConnection.voidcmd('quote guardian') > > ftpConnection.putcmd('quote guardian') > > saying basically what I described above. The weirdness of the whole > > situation is that if I do it manually, it always works. > > This probably doesn't have too much to do with jython, but when I > encounter problems like that I usually use tcpdump or some similar > program to see what is actually sent between the client and the > server. > > The ftp library might very well do some strange quoting or invalid > linefeed or something that ruins the command. > > \EF > -- > Erik Forsberg, Cendio Systems AB. > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: John G. <jgo...@co...> - 2001-11-08 17:17:53
|
Jeff Emanuel <je...@ad...> writes: > This seems a little more familiar since you are loading the java > class with a custom class loader. When this has worked for me > before, I have always used the system default class loader. Oddly enough, I didn't even realize that class loaders even existed until your message yesterday, and certainly not that a non-default loader was already being used. Alas, I fear that I have no control over what loader is being used at the moment. > Try finding the classloader for the superclass, as jython sees it. > Something like this: I tried this, just from Python at the top of the module: print "Superclass loader: " + ListBO.getClassLoader().getClass().getName() Prior to your suggested hack below, this printed out org.python.core.SyspathJavaLoader. > I suspect that the jython super is not loaded by the same classloader and This is true... > that is the root of your problems. I'm not sure if there is a way to ... but it doesn't seem to be the root of my problems. > You might be able to set your custom classloader in the interpreter's > name space and rewrite your scripts to use that. Something like this: [ snip ] I had to hack it to get the variable into the module, but I got it to do that. > ListBO=classloader.loadClass("quovix.business.util.ListBO") Now, the above print displays com.lutris.classloader.MultiClassLoader -- the same as for my code in static Java. But -- I still get the same ClassCastException in Java as before -- probably because the ListBOFoo object is still being loaded by Python's loader (ByteLoader1). -- John |
From: Jeff E. <je...@ad...> - 2001-11-08 16:23:52
|
This seems a little more familiar since you are loading the java class with a custom class loader. When this has worked for me before, I have always used the system default class loader. Try finding the classloader for the superclass, as jython sees it. Something like this: interp.exec("super=mod.ListBO"); Object pySuperClass = interp.get("super",Object.class); System.out.println(pySuperClass); System.out.println( ((Class)pySuperClass).getClassLoader().getClass().getName()); I suspect that the jython super is not loaded by the same classloader and that is the root of your problems. I'm not sure if there is a way to tell the jython interpreter to use your custom classloader without having to rewrite your scripts. Samuele Pedroni would probably be able to answer that right off. You might be able to set your custom classloader in the interpreter's name space and rewrite your scripts to use that. Something like this: In Java: interp.set("classloader",this.getClass().getClassLoader()); In Python: # Replace normal Python import syntax with this: ListBO=classloader.loadClass("quovix.business.util.ListBO") class ListBOFoo(ListBO): # The rest as usual It certainly would be preferable to hook into the jython import mechanism instead. I don't know how to do that. John Goerzen wrote: > OK. I did: > > System.out.println(this.getClass().getClassLoader().getClass().getName()); > System.out.println(newobj.getClass().getClassLoader().getClass().getName()); > > Resulting in: > > com.lutris.classloader.MultiClassLoader > org.python.core.BytecodeLoader1 > > MultiClassLoader is a subclass of java.lang.ClassLoader adding in > functionality such as loading classes from URLs, ZIPs, etc. (This is > an Enhydra servlet). > > Interestingly, this is JDK 2 but it's using Jython's JDK 1 > BytecodeLoader. > > Let me show you exactly what I'm trying to do: > > In Java: (before adding the printlns and other debug stuff) > > PythonInterpreter interp = new PythonInterpreter(); > interp.exec("mod = __import__('" + brob + "')"); > interp.exec("cl = mod." + brob + "()"); > Object newobj = interp.get("cl", Object.class); > return (ListBO) newobj; > > In this case, 'brob' is ListBOFoo, and it's loading this Python code: > > from quovix.business.util import * > > class ListBOFoo(ListBO): > def getDescription(self): > desc = ListBO.getDescription(self) # Superclass call > return "Foo_" + desc > > Very simple stuff. I have it working with jythonc but I'm trying to > eliminate jythonc from the picture so it can be loaded 100% > dynamically. > > Thanks for your assistance! > > -- John > > > Jeff Emanuel <je...@ad...> writes: > > >>The java class Class has a method to return its ClassLoader. >>You can do something like this: >> >> System.out.println(this.getClass().getClassLoader()); >> System.out.println(newobj.getClass().getClassLoader()); >> >>If they are different, the classes are in effect not equal. >>I'm not sure why that would be or how to work around it. I've >>done things as you are trying and it worked. If we know >>what the classloaders are, perhaps we can discover why they >>are different, or what action to take. >> >>You can also try newobj.getClass().isAssignableFrom(this.getClass()) >> >>That is likely to be false since you know you can't do the cast. >> >> >> >>John Goerzen wrote: >> >> >>>Jeff Emanuel <je...@ad...> writes: >>> >>> >>>>It is likely that your ListBO class was loaded by two different class >>>>loaders. Try printing out the classloaders for your Java this instance >>>>and your newobj. Even if the classes are the same, if they were loaded >>>>by different loaders, then they really aren't equal. >>>> >>>> >>>OK this is unfamiliar territory for me. I don't know what a class >>> >>>loader is or how to print it. If the loaders are different, how would >>>I go about resolving the problem? One is the regular static stuff >>>loaded as usual with classes generated by javac; the other, Python. >>>Ideas? >>>Thanks! >>> >>>-- John >>> >> >> > |
From: <jgo...@co...> - 2001-11-08 16:05:40
|
Jeff and I have been discussing this off-list; I figured I'd send the discussion back to the list. -- John ----- Forwarded message from John Goerzen <jgo...@co...> ----- X-Addr-Extension: sent-mail To: Jeff Emanuel <je...@ad...> Subject: Re: [Jython-users] tojava() failing From: John Goerzen <jgo...@co...> OK. I did: System.out.println(this.getClass().getClassLoader().getClass().getName()); System.out.println(newobj.getClass().getClassLoader().getClass().getName()); Resulting in: com.lutris.classloader.MultiClassLoader org.python.core.BytecodeLoader1 MultiClassLoader is a subclass of java.lang.ClassLoader adding in functionality such as loading classes from URLs, ZIPs, etc. (This is an Enhydra servlet). Interestingly, this is JDK 2 but it's using Jython's JDK 1 BytecodeLoader. Let me show you exactly what I'm trying to do: In Java: (before adding the printlns and other debug stuff) PythonInterpreter interp = new PythonInterpreter(); interp.exec("mod = __import__('" + brob + "')"); interp.exec("cl = mod." + brob + "()"); Object newobj = interp.get("cl", Object.class); return (ListBO) newobj; In this case, 'brob' is ListBOFoo, and it's loading this Python code: from quovix.business.util import * class ListBOFoo(ListBO): def getDescription(self): desc = ListBO.getDescription(self) # Superclass call return "Foo_" + desc Very simple stuff. I have it working with jythonc but I'm trying to eliminate jythonc from the picture so it can be loaded 100% dynamically. Thanks for your assistance! -- John Jeff Emanuel <je...@ad...> writes: > The java class Class has a method to return its ClassLoader. > You can do something like this: > > System.out.println(this.getClass().getClassLoader()); > System.out.println(newobj.getClass().getClassLoader()); > > If they are different, the classes are in effect not equal. > I'm not sure why that would be or how to work around it. I've > done things as you are trying and it worked. If we know > what the classloaders are, perhaps we can discover why they > are different, or what action to take. > > You can also try newobj.getClass().isAssignableFrom(this.getClass()) > > That is likely to be false since you know you can't do the cast. > > > > John Goerzen wrote: > > > Jeff Emanuel <je...@ad...> writes: > > > > >>It is likely that your ListBO class was loaded by two different class > >>loaders. Try printing out the classloaders for your Java this instance > >>and your newobj. Even if the classes are the same, if they were loaded > >>by different loaders, then they really aren't equal. > >> > > OK this is unfamiliar territory for me. I don't know what a class > > > loader is or how to print it. If the loaders are different, how would > > I go about resolving the problem? One is the regular static stuff > > loaded as usual with classes generated by javac; the other, Python. > > Ideas? > > Thanks! > > > -- John > > > > > > -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org ----- End forwarded message ----- |
From: Erik F. <for...@ce...> - 2001-11-08 15:29:00
|
Hubert Yoshizaki <yos...@da...> writes: > ftpConnection.sendcmd('quote guardian') > ftpConnection.voidcmd('quote guardian') > ftpConnection.putcmd('quote guardian') > saying basically what I described above. The weirdness of the whole > situation is that if I do it manually, it always works. This probably doesn't have too much to do with jython, but when I encounter problems like that I usually use tcpdump or some similar program to see what is actually sent between the client and the server. The ftp library might very well do some strange quoting or invalid linefeed or something that ruins the command. \EF -- Erik Forsberg, Cendio Systems AB. |
From: John G. <jgo...@co...> - 2001-11-07 20:51:28
|
And as an additional data point: If I request an object of type java.lang.Object from get(), get() works. What's more, newobj.getClass().getSuperclass().getName() returns quovix.business.util.ListBO! However, casting newobj from Object to ListBO fails with a java.lang.ClassCastException on ListBOFoo$ListBOFoo$0! I'm rather mystified now. John Goerzen <jgo...@co...> writes: > Hi, > > I am accessing some python code from Java. When I try to use > interp.get() (where inter is a PythonInterpreter object), I get an > error saying it can't convert my object to the appropriate Java one. > > However! > > My object is a python subclass of the Java object I want it to be. > > IE, in Java I'm saying: > > ListBO newobj = (ListBO) interp.get("cl", this.getClass()); > > ("this" is a ListBO instance) > > In Python, cl is a variable that holds an instance of a ListBOFoo > class, which is defined: > > class ListBOFoo(quovix.business.util.ListBO): > ... > > The code seems to work (quovix is imported properly, etc). It's just > that calling "get" on it returns the conversion problem. > > I'm not sure where to go to fix this. Ideas? > > -- John > > -- > John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: John G. <jgo...@co...> - 2001-11-07 20:22:09
|
Hi, I am accessing some python code from Java. When I try to use interp.get() (where inter is a PythonInterpreter object), I get an error saying it can't convert my object to the appropriate Java one. However! My object is a python subclass of the Java object I want it to be. IE, in Java I'm saying: ListBO newobj = (ListBO) interp.get("cl", this.getClass()); ("this" is a ListBO instance) In Python, cl is a variable that holds an instance of a ListBOFoo class, which is defined: class ListBOFoo(quovix.business.util.ListBO): ... The code seems to work (quovix is imported properly, etc). It's just that calling "get" on it returns the conversion problem. I'm not sure where to go to fix this. Ideas? -- John -- John Goerzen <jgo...@co...> GPG: 0x8A1D9A1F www.complete.org |
From: Aparna S. <apa...@ya...> - 2001-11-07 16:00:28
|
file & complie the...please give an example Thanks, Aparna --------------------------------- Do You Yahoo!? Find a job, post your resume on Yahoo! Careers. |
From: John G. <jgo...@co...> - 2001-11-07 13:44:33
|
Hi, Today I tried to use jythonc to compile some code that subclassed one of my own Java classes. This was code that was supposed to be called by Java. jythonc refused to recognize that this class was a subclass of the Java one, repeatedly. Finally I tried saying it was a subclass of java.lang.Date -- voila -- it worked. So I tried to find out why. Apparently, the problem was that one of the classes that the base class needed was not on the CLASSPATH. jythonc did not so much as even issue a warning when it should have issued an error. It took me hours to track this down rather than 5 minutes it should have. Running the script with jython finally made the error clear right away. Can we get some error checking in jythonc? Thanks! -- John |
From: rpcee <rp...@op...> - 2001-11-07 13:39:53
|
In Java, where the type information is explicit in the source, modern IDEs allow you to get lots of context sensitive information available for the source (eg press "." and JBuilder gives you a list of methods, F1 gets you the relevant help, etc). In PythonWin at least the "." function appears to operate when there is actually an instantiated instance (eg from code executed in the interactive window or an executed script), which is not always correct in the context of a script being edited. When using Jython, is there any environment which provides usable context sensitive information, is such a thing possible? Is there any information on how the lack of such features negates the productivity boost provided by jython? Thanks, rich. [ps, On the jython website it talks about the "lastest release" rather than the "latest". Where I'm from last is slang for rubbish, which is certainly not a suitable adjective for jython :)] |
From: dman <ds...@ri...> - 2001-11-06 22:11:15
|
Could someone please explain to me, again, why jython munges streams after the fashion of ms windows if binary mode isn't specified? I just had a real (annoying) waste of time tracking down why imaplib would throw an unexpected response exception (on all correct responses, except UID responses), but worked beautifully with cpython. I am now submitting the patch below to cpython on sourceforge (that's where the module is maintained, right? I know that the debian package uses cpython's modules). TIA, -D *** /usr/lib/python2.1/imaplib.py Sat Oct 20 10:48:35 2001 --- lib/modules/imaplib.py Tue Nov 6 16:59:15 2001 *************** *** 198,204 **** """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! self.file = self.sock.makefile('r') def recent(self): --- 198,206 ---- """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! # use binary mode -- with jython (java) not specifying binary mode ! # causes a CRLF->LF translation and screws up the data later on ! self.file = self.sock.makefile('rb') def recent(self): |
From: dman <ds...@ri...> - 2001-11-04 17:56:55
|
On Sun, Nov 04, 2001 at 04:19:24PM +0100, rob...@ya... wrote: | hi, | | im missing the __builtins__-variable from | the globals()-function. did someone steal it? ;-) No : I was informed once that the __builtins__ name is an implementation detail of cpython. The real module name is __builtin__ and you need to import it if you want to mess with it. -D |
From: dman <ds...@ri...> - 2001-11-04 17:56:03
|
On Sun, Nov 04, 2001 at 04:13:55PM +0100, rob...@ya... wrote: | hi finn, | | what i dont get is: why dont you use the os-module | that comes with cpython? | | >>>>>copy of os.py<<<<<< | import sys | | _names = sys.builtin_module_names | altsep = None | if 'posix' in _names: | <<<<<<<<<<<<<<<<<<<<<<<<<<< | | if sys.builtin_module_names would return the | nt or so everything would just run fine (id | assume ;-) ) | the os module implementation stuff relies on the C api of the os itself, if you go deep enough. Java is, in a sense, a separate OS because it doesn't follow POSIX or Windows but does its own thing. -D |