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: Coleman, D. <don...@em...> - 2001-01-25 19:25:34
|
I get a ClassCastException trying to narrow a reference to an EJB home using JDK1.3 (on Win32). This code works fine with JDK1.2.2 (on Win32). I get the same problem with jpython-1.1. Am I doing something wrong or is this a bug? CODE THAT CAUSES THE PROBLEM jndiContext = InitialContext() object = jndiContext.lookup("emax.ContainerManager") # next line blows up with JDK 1.3 but not JDK1.2.2 managerHome = PortableRemoteObject.narrow(object, ContainerManagerHome.class) manager = managerHome.create() STACK TRACE File "e:\home\ESM\src\com\emax\container\c.py", line 69, in getContainerManage r java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Porta bleRemoteObject.java:296) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137) at java.lang.reflect.Method.invoke(Native Method) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java :158) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java :166) at org.python.core.PyObject.__call__(PyObject.java:285) at org.python.core.PyObject.invoke(PyObject.java:2119) at c$py.getContainerManager$4(e:\home\ESM\src\com\emax\container\c.py) at c$py.call_function(e:\home\ESM\src\com\emax\container\c.py) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.PyTableCode.call(PyTableCode.java:200) at org.python.core.PyFunction.__call__(PyFunction.java:93) at org.python.pycode._pyx6.f$0(<console>) at org.python.pycode._pyx6.call_function(<console>) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.Py.runCode(Py.java:1055) at org.python.core.Py.exec(Py.java:1076) at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:145) at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter .java:87) at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret er.java:68) at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpret er.java:42) at org.python.util.InteractiveConsole.push(InteractiveConsole.java:83) at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:6 2) at org.python.util.jython.main(jython.java:178) java.lang.ClassCastException: java.lang.ClassCastException |
From: <bc...@wo...> - 2001-01-25 19:15:15
|
[Will] >I have run into some surprising behavior of Java Integer objects while using >jython: > >public class Test { > > public void foo(Integer I) { > System.out.println("Called with an Integer."); > } > > public void foo(int i) { > System.out.println("Called with an int."); > } > > public static void main(String[] args) { > > ... initialize PythonInterpreter ... > > myInterpreter.exec("test = Test()"); > myInterpreter.exec("test.foo(Integer(1))"); > myInterpreter.exec("test.foo(2)"); > } > } > > >Expected output: > Called with an Integer. > Called with an int. > >Actual output: > Called with an int. > Called with an int. > > >I have noticed similar behavior with Double objects. > >What am I doing wrong? How can I keep Integer and Double objects from being >converted to Java primitives? You can't. The eagerness with which Jython converts the java.lang.* wrapper classes to instances of native python classes have been discussed previousely: http://mail.python.org/pipermail/jpython-interest/1999-December/002590.html It is basicly the same problem you have re-discovered. I'm still not convinved that it is a net win to reduce this eagerness. http://mail.python.org/pipermail/jpython-interest/1999-December/002596.html >Also, why does the following call to equals() on an Integer object... > > myInterpreter.set("myInteger", new Integer(1)); > myInterpreter.exec("myInteger.equals(Integer(1))"); > >...result in an exception? > > Exception in thread "main" Traceback (innermost last): > File "<string>", line 1, in ? > AttributeError: 'int' object has no attribute 'equals' Use this instead: myInterpreter.set("myInteger", new PyJavaInstance(new Integer(1))); myInterpreter.exec("myInteger.equals(Integer(1))"); regards, finn |
From: Byrd, W. <Wil...@co...> - 2001-01-25 17:12:37
|
I have run into some surprising behavior of Java Integer objects while using jython: public class Test { public void foo(Integer I) { System.out.println("Called with an Integer."); } public void foo(int i) { System.out.println("Called with an int."); } public static void main(String[] args) { ... initialize PythonInterpreter ... myInterpreter.exec("test = Test()"); myInterpreter.exec("test.foo(Integer(1))"); myInterpreter.exec("test.foo(2)"); } } Expected output: Called with an Integer. Called with an int. Actual output: Called with an int. Called with an int. I have noticed similar behavior with Double objects. What am I doing wrong? How can I keep Integer and Double objects from being converted to Java primitives? Also, why does the following call to equals() on an Integer object... myInterpreter.set("myInteger", new Integer(1)); myInterpreter.exec("myInteger.equals(Integer(1))"); ...result in an exception? Exception in thread "main" Traceback (innermost last): File "<string>", line 1, in ? AttributeError: 'int' object has no attribute 'equals' Note that the following version works just fine: myInterpreter.exec("myInteger = Integer(1)"); myInterpreter.exec("myInteger.equals(Integer(1))"); Thanks. Regards, Will |
From: <bc...@wo...> - 2001-01-25 11:17:26
|
[Donatas Simkunas] >Is there ability using jython and pickle save objects which classes is java >classes ? No (as you have dicovered yourself). >for example: > >>>> import cPickle >>>> from java.awt import Rectangle >>>> r=Rectangle(1,1,200,300) >>>> f=open("fileout","w") >>>> cPickle.dump(r,f) >Traceback (innermost last): > File "<console>", line 1, in ? >PicklingError: Unable to pickle java objects. > >>>> import pickle >>>> pickle.dump(r,f) >Traceback (innermost last): > File "<console>", line 1, in ? > File "/home/donce/jython-2.0/Lib/pickle.py", line 888, in dump > File "/home/donce/jython-2.0/Lib/pickle.py", line 100, in dump > File "/home/donce/jython-2.0/Lib/pickle.py", line 202, in save > File "/home/donce/jython-2.0/Lib/pickle.py", line 421, in save_inst >AttributeError: class 'java.awt.Rectangle' has no attribute '__module__' >>> > >Is there something what i missed ? > >Workaround for this is to use java objects serialization, but if i use python >there should be ability to use python serialization. I suppose it is possible to extend the pickle protocol to contain tags for serialized java objects and to use the pickle.memo table to detect and resolve circular graphs amoung the javaobject, but it is not something I will add. Patches will be accepted. regards, finn |
From: <bc...@wo...> - 2001-01-25 11:16:55
|
[William Byrd] >[...] >The getLocals() method returns a >*reference* to the PythonInterpreter.locals object, rather than a deep copy. >The result is that the object referenced by 'initialState' is modified when >I make additional calls to PythonInterpreter.exec(). > >Peeking at the source code for PythonInterpreter allowed me to create the >following hack: > > ... Set up the initial state of myInterpreter, as before ... > > // Save the initial state of myInterpreter. > PyStringMap localsMap = (PyStringMap) > myInterpreter.getLocals(); > PyObject initialState = (PyObject) localsMap.copy(); > > ... Change the state of myInterpreter, as before ... > > // Restore the initial state of myInterpreter. > myInterpreter.setLocals(((PyStringMap) > initialState).copy()); > >Of course, this code will break if the return type of getLocals() ever >changes. Right. While the odds are low for that to happen the hack of casting to a specific subtype is both wrong and fragile. The right (IMO) way is use only the methods on PyObject to call the methods in the PyStringMap: ... Set up the initial state of myInterpreter, as before .. // Save the initial state of myInterpreter. PyObject localsMap = myInterpreter.getLocals(); PyObject initialState = localsMap.invoke("copy"); ... Change the state of myInterpreter, as before ... // Restore the initial state of myInterpreter. myInterpreter.setLocals(initialState.invoke("copy")); This will work as long as the "locals" is an object that conforms to the mapping interface (whatever that actually mean). This is true for both PyStringMap and PyDictionary as well as any python object that implement the __[get|set]item__ and copy methods. >How can I achieve the same result without resorting to a hack? Should >getLocals() return a deep copy of PythonInterpreter.locals? No. >Am I using the getLocals() and setLocals() inappropriately? No. regards, finn |
From: Donatas S. <do...@no...> - 2001-01-25 06:18:30
|
Is there ability using jython and pickle save objects which classes is java classes ? for example: >>> import cPickle >>> from java.awt import Rectangle >>> r=Rectangle(1,1,200,300) >>> f=open("fileout","w") >>> cPickle.dump(r,f) Traceback (innermost last): File "<console>", line 1, in ? PicklingError: Unable to pickle java objects. >>> import pickle >>> pickle.dump(r,f) Traceback (innermost last): File "<console>", line 1, in ? File "/home/donce/jython-2.0/Lib/pickle.py", line 888, in dump File "/home/donce/jython-2.0/Lib/pickle.py", line 100, in dump File "/home/donce/jython-2.0/Lib/pickle.py", line 202, in save File "/home/donce/jython-2.0/Lib/pickle.py", line 421, in save_inst AttributeError: class 'java.awt.Rectangle' has no attribute '__module__' >> Is there something what i missed ? Workaround for this is to use java objects serialization, but if i use python there should be ability to use python serialization. -- Donatas Simkunas |
From: Byrd, W. <Wil...@co...> - 2001-01-25 04:32:50
|
Hello all. I am trying to embed jython in a Java app, but I have encountered a stumbling block. I want to instantiate and initialize a PythonInterpreter object, immediately save the initialized state of the interpreter object, and periodically restore that initialized state. The PythonInterpreter getLocals() and setLocals() methods seem to be just what I need: myInterpreter = new PythonInterpreter(); // Set up the initial state of myInterpreter. myInterpreter.exec("from java.lang import Integer"); ... much more setup code here ... // Save the initial state of myInterpreter. PyObject initialState = myInterpreter.getLocals(); // Change the state of myInterpreter. myInterpreter.exec("from java.util import Random"); ... much more code here ... // Try to restore the initial state of myInterpreter. // This doesn't work, since 'initialState' was modified // by the previous invocation of exec(). myInterpreter.setLocals(initialState); Unfortunately, this code does not work. The getLocals() method returns a *reference* to the PythonInterpreter.locals object, rather than a deep copy. The result is that the object referenced by 'initialState' is modified when I make additional calls to PythonInterpreter.exec(). Peeking at the source code for PythonInterpreter allowed me to create the following hack: ... Set up the initial state of myInterpreter, as before ... // Save the initial state of myInterpreter. PyStringMap localsMap = (PyStringMap) myInterpreter.getLocals(); PyObject initialState = (PyObject) localsMap.copy(); ... Change the state of myInterpreter, as before ... // Restore the initial state of myInterpreter. myInterpreter.setLocals(((PyStringMap) initialState).copy()); Of course, this code will break if the return type of getLocals() ever changes. How can I achieve the same result without resorting to a hack? Should getLocals() return a deep copy of PythonInterpreter.locals? Am I using the getLocals() and setLocals() inappropriately? Thanks. Regards, -- William Byrd |
From: Robert W. B. <rb...@di...> - 2001-01-25 02:13:59
|
Hello Gottfried, On Wed, 24 Jan 2001, Gottfried F. Zojer wrote: > Hi, > > Is somebody using jython 2.0 on a SUSE 7.0 box. > I tried it with the old versions JPython but it never > worked even when my Java-settings was ever correct > because I used VisualAge and also ArgoUML pretty fine. > Whats wrong with it.I can start and execute jythonc > and jython but I cant do anything with it.Alone to do > a 4+3 is not working. > I can see the following when I start jython via > tkdesk filemanager. > Jython 2.0rc1 on java1.2.2 (J.I.T: sunwjit) > type "copyright","credits" or "license" for more > information. > >>>> Seeing the above information is a good sign. I'm a bit confused when you say it doesn't work, but you get the appropriate startup message. What's missing is what happens _after_ you see the ">>>". Are you saying you are unable to type anything at this prompt? If so, start a bash shell and start Jython from there- is it any different? Do you see a traceback? If you can type at the prompt, it is likely working, i.e.- >>>4+3 7 >>> If this does not work, try making a file (test.py) with one line saying "print 4+3" (without the quotes). Then type "jython test.py" at the bash prompt. Do you see 7 or a traceback? If it just hangs again as you say, try export CLASSPATH="" and run it again. The Linux distro doesn't really matter, the jvm does the work. The things that can create problems have always created tracebacks for me in all *nix I've used, so it would be news if this really just froze as your note implies. If none of this works and you still can't get a useful traceback, please forward more info- classpath, what ps aux says, machine details, stuff like that. Good luck, -Robert |
From: Robert W. B. <rb...@di...> - 2001-01-25 01:34:40
|
Hello Anne, [On Wed, 24 Jan 2001, Anne Wilson wrote] > Hello jython developers, > > I am a devoted fan of python. Six to nine months ago I looked into > JPython but was disappointed to find that it did not support the tkinter > module. Is this because tkinter relies on tcl and tk? "C" really- first things first. > What kind of GUI tools does jython provide? What Java provides. > Anything based on swing? Not really "based on"... It's likely you spend a lot of time with CPython where there is a clear distinction between the Python code and the C code. CXX, extensionclasses, swig, etc make for a intimidating bump between C and Python. However, it's this sense of boundary that evaporates in Jython with ">>>import java". You just may not realize it at first :) In other words, it is AWT, Swing and GUI components written for java because you import things that are Java. The demos that are installed with Jython include AWT and Swing demos. > Are there any plans along these lines for the future? Based on the above I'm tempted to say, "The future is here." But that would be melodramatic, opportunistic and painful<wink>. Do visit the docs at http://jython.sourceforge.net/docs/index.html then just try and stop yourself from going to: http://jython.sourceforge.net/download.html. Cheers, -Robert PS- forwarded from jython-dev to jython-users. |
From: <go...@ya...> - 2001-01-25 01:10:57
|
Hi, Is somebody using jython 2.0 on a SUSE 7.0 box. I tried it with the old versions JPython but it never worked even when my Java-settings was ever correct because I used VisualAge and also ArgoUML pretty fine. Whats wrong with it.I can start and execute jythonc and jython but I cant do anything with it.Alone to do a 4+3 is not working. I can see the following when I start jython via tkdesk filemanager. Jython 2.0rc1 on java1.2.2 (J.I.T: sunwjit) type "copyright","credits" or "license" for more information. >>>> __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/ |
From: <bc...@wo...> - 2001-01-24 11:37:40
|
[Chris Atkins] >I am embedding jython in my code. How would I pass the -D options to the >InteractiveConsole? [finn] > Take a look at 6.2 in the faq: > > http://jython.sourceforge.net/cgi-bin/faqw.py?req=all#6.2 > > You can set python.security.respectJavaAccessibility in the same way. It > most be done before creating any python objects, including the creation > of the interpreter. [back to Chris] >In my java code I do the following: > java.util.Properties props = System.getProperties(); >add properties for other tools with names which do not conflict with python > PySystemState.initialize(pyProps, null, s_scriptArgs); Is pyProps a typo? I guess you mean props. >I start up my app with >PYFLAGS="-Dpython.home=$JPYTHONDIR -Dpython.path=$JPYTHONPATH -D >python.cachedir=$JPYTHONCACHEDIR" > >java -classpath . $PYFLAGS MyClass args > >This should have place the python properties in both the system properties >and set them on the interactive console. According to the rules, it should >have picked up the $PYFLAGS over the registry No. The rules on the registry.html says Jython properties > registry files > System.properties. i.e. the registry files will typically be searched before the System.properties. >since set on the PySystemState. That makes no difference. The org.python.util.jython class also calls initialize with: PySystemState.initialize(System.getProperties(), opts.properties, opts.argv); where opts.properties contains the -D options found as argument to jython class (aka Jython properties). >It instead used what is in the registry. Right. In your examples, the value for jython properties is null (meaning empty) so the registry files is searched first. Only if nothing is found there is the System.properties searched. >I changed my code to do the following: > > java.util.Properties pyProps = new java.util.Properties(); > pyProps.setProperty("python.security.respectJavaAccessibility", "0"); > if (s_scriptArgs == null) s_scriptArgs = new String[0]; > PySystemState.initialize(pyProps, null, s_scriptArgs); I guess this will do most of what you're after: java.util.Properties pyProps = new java.util.Properties(); # Insert selected (or maybe all?) System.properties into # jython properties. String s = System.getProperty("python.home"); if (s != null) pyProps.setProperty("python.home", s); s = System.getProperty("python.path"); if (s != null) pyProps.setProperty("python.path", s); s = System.getProperty("python.cachedir"); if (s != null) pyProps.setProperty("python.cachedir", s); # Set some application properties. pyProps.setProperty("python.security.respectJavaAccessibility", "0"); PySystemState.initialize(System.getProperties(), pyProps, s_scriptArgs); >Can you explain this? I hope the above helps. All in all, I think the property lookup mechanism as mostly Ok. Perhaps we should have a way of changing the lookup priority since I guess you would rather use: Jython properties > System.properties > registry files OTOH we shouldn't make it more complicated for novices. The only real drawback I know off, is the use of the -D command line option for jython properties. This is commonly used by the java command as well and that can be confusing. regards, finn |
From: Chris A. <at...@nm...> - 2001-01-23 18:02:46
|
> > >I am embedding jython in my code. How would I pass the -D > options to the > >InteractiveConsole? > > Take a look at 6.2 in the faq: > > http://jython.sourceforge.net/cgi-bin/faqw.py?req=all#6.2 > > You can set python.security.respectJavaAccessibility in the > same way. It > most be done before creating any python objects, including > the creation > of the interpreter. > In my java code I do the following: java.util.Properties props = System.getProperties(); add properties for other tools with names which do not conflict with python PySystemState.initialize(pyProps, null, s_scriptArgs); I start up my app with PYFLAGS="-Dpython.home=$JPYTHONDIR -Dpython.path=$JPYTHONPATH -D python.cachedir=$JPYTHONCACHEDIR" java -classpath . $PYFLAGS MyClass args This should have place the python properties in both the system properties and set them on the interactive console. According to the rules, it should have picked up the $PYFLAGS over the registry since set on the PySystemState. It instead used what is in the registry. I changed my code to do the following: java.util.Properties pyProps = new java.util.Properties(); pyProps.setProperty("python.security.respectJavaAccessibility", "0"); if (s_scriptArgs == null) s_scriptArgs = new String[0]; PySystemState.initialize(pyProps, null, s_scriptArgs); Now, since I am not setting python.home, python.path, python.cachedir in my java code, they are not being picked up from the system properties set on the command line. Can you explain this? I really want to pick up the properties which have path names from the command line, but the application specific settings such as respectJavaAccessibility from the application. Chris Atkins |
From: <bc...@wo...> - 2001-01-23 15:19:42
|
[Chris Atkins] >It appears that the problem was that the registry had >python.security.respectJavaAccessibility = true > >When I commented this out of the registry file it worked. > > >Can you please explain the difference between: >The Java system properties: typically passed in on the command line as >options to the java interpreter. > >Jython properties: Specified on the command >line as options to the jython class. See the -D option to the interpreter. > >I believe the top one says if I place the -D parms before the class name on >the java statement as in: >java -Dpython.security.respectJavaAccessibility=0 org.python.util.jython > >The second would be >java org.python.util.jython -Dpython.security.respectJavaAccessibility=0 Correct. And because the "registry" file is read in between, it will overwrites the values assigned as system properties. >I am embedding jython in my code. How would I pass the -D options to the >InteractiveConsole? Take a look at 6.2 in the faq: http://jython.sourceforge.net/cgi-bin/faqw.py?req=all#6.2 You can set python.security.respectJavaAccessibility in the same way. It most be done before creating any python objects, including the creation of the interpreter. regards, finn |
From: Elisabeth u. A. H. <e.h...@ed...> - 2001-01-23 02:08:46
|
> [Ype on the pairing of Jython and CPython through JNI] > I like this idea, too. However, I don't like the solution of loading python.dll and then having CPython do the work for the imported module. Instead, I propose a C-Java-brigde via JNI in both directions: For Jython as suggested. For the C-extension module providing wrappers for the functions declared in python.h that delegate the work back to Jython via JNI (using proxies for allocated objects). This should also solve the callback and subclassing problems. Regards, Andreas |
From: D-Man <ds...@ri...> - 2001-01-23 00:25:44
|
On Fri, Jan 19, 2001 at 12:33:50PM +0000, Finn Bock wrote: [snip] | The Jython RE syntax is exactly the same as CPython2.0. What you have | encountered is a bug in the Microsoft JVM. Surprising? ;-) [snip] | By rewriting the code a little bit, I have avoided the MS bug, so the | problem will not exist in the next release of jython. IMO, you shouldn't be expending effort to fix M$ bugs Finn. But I'm sure the people using the M$ JVM will appreciate it. You certainly work hard to make jython work the Right Way. :-) | | regards, | finn | -D |
From: D-Man <ds...@ri...> - 2001-01-23 00:23:42
|
Oops, I didn't have the mailfolder listed in my MUA. Wow. The list isn't dead. :-) On Fri, Jan 19, 2001 at 03:08:13PM +0000, Finn Bock wrote: | On Thu, 18 Jan 2001 17:27:39 -0500, you wrote: | | >How can you access Python classes / modules directly from Java? | | A python class can implement a java interface or java class by listing | the java interface as a base class. Instances of such a python class can | be passed to java code as a parameter and used as any other java class. | | In addition, the command "jythonc" can be be used to create a java class | from a python module. Such a java class be used from a java program as a | normal java class. Including in a "new" statement. I just found it in the FAQ -- I need to include @sig in the doc string. I was using jythonc, but it didn't create a Java interface that matched my Python interface (it simply called into the interpreter to execute the python stuff). | | regards. | finn I'll check it out some more. Thanks, -D |
From: Robert W. B. <rb...@di...> - 2001-01-23 00:00:54
|
Hello, (tnx for the speedy reply Finn!) Unfortunately, I'm still stuck. Maybe this is different enough that I should include some code examples and the full story: In using Tomcat-3.2.1, Jython-2.0, sun jdk-1.2.2, win98. I've placed jython.jar in %TOMCAT_HOME%\webapps\jython\WEB-INF\lib and would also like to place the below servlet (and many frozen modules) in the same lib directory as jyDispatch.jar. Ahhh, the dream of an entirely frozen webapp that could be delivered to clients in a *.war file just like all the java servlet/JSP webapps out there, but secretly using Jython :) Here's the code: -------------------------------------------------------------- #filename: jyDispatch.py import sys sys.prefix="." from javax import servlet from javax.servlet import http import os class jyDispatch(http.HttpServlet): def service(self,req, res): 'Jython servlet dispatcher' mtimes = {} ctx = self.getServletContext() #test junk out = res.getWriter() out.println("<br>sys.path=" + str(sys.path)) out.println("<br>sys.prefix=" + str(sys.prefix)) out.println("<br>cwd=" + str(sys.getcwd())) # Get the path of the *.py file to be dispatched path = ctx.getRealPath( req.getServletPath() ) mtime = os.stat(path)[7] #Other stuff... ---------------------------------------------------------------- The "sys.prefix='.'" was added as suggested and it was compiled with the implied: jythonc -j jyDispatch.jar -a jyDispatch.py However, none of the javaos code is accessible. getcwd, and stat in the example above are hidden. It seems very much like the example you (Finn) used, but I'm having no luck muxing with the sys.prefix or sys.path in the servlet to get around this. All hints and comments are welcome as always :) Thanks in advance. -Robert [Robert W. Bill] >>Freezing servlet applications have resulted in difficulty with >>the javaos module. The simple scenario is I need to use >>os.stat(file), but all frozen applications return the error: >> >> AttributeError: class 'org.python.modules.os' has no >> attribute 'stat' >> >>When using jythonc, i've tried: >> >> jythonc -a -j app.jar jyDispatch.py >> jythonc -a -j app.jar jyDispatch.py javaos os re string >> jythonc -c -j app.jar jyDispatch.py javaos etc.... >> >>All result in the above AttributeError. >> >>I've assumed stat requires os + javaos- does it? >Yes. >>How do I freeze an application so that I can use it? >When I just tried to freeze this little module I got an NPE: > > import os > print os.stat > >This is an unintended sideeffect on a hack I added to satisfy >site.py's use of the os module. It occur when sys.prefix is None >which typically happens for frozen applications. > >Changing the module to: > > import sys > sys.prefix = "." > > import os > print os.stat > >and it runs as expected. I compiled the module with the >simple: > > jythonc.bat -j app.jar -a app.py >I'm not 100% sure this is the situation you are seeing, but >please give it a try. >regards, >finn |
From: Chris A. <at...@nm...> - 2001-01-22 22:59:51
|
It appears that the problem was that the registry had python.security.respectJavaAccessibility = true When I commented this out of the registry file it worked. Can you please explain the difference between: The Java system properties: typically passed in on the command line as options to the java interpreter. Jython properties: Specified on the command line as options to the jython class. See the -D option to the interpreter. I believe the top one says if I place the -D parms before the class name on the java statement as in: java -Dpython.security.respectJavaAccessibility=0 org.python.util.jython The second would be java org.python.util.jython -Dpython.security.respectJavaAccessibility=0 I am embedding jython in my code. How would I pass the -D options to the InteractiveConsole? Chris Atkins > -----Original Message----- > From: Finn Bock [mailto:bc...@wo...] > Sent: Monday, January 22, 2001 4:32 PM > To: jyt...@li... > Cc: at...@nm... > Subject: Re: [Jython-users] Ignoring Java Access > > > [Chris Atkins] > > >I am running jython 2.0 release on hpux 11 with jdk1.2.2.07. > > > >I run my jython interpretter > >with -Dpython.security.respectJavaAccessibility= 0 and =false. > > > >In both cases, I am unable to access protected methods of a class. > > > >I just switched out my jar file from using jpython1.1 to > jython2.0, and it > >works under under jpython1.1 > > > >My python code looks like the following: > > > >print foo.toPrintString(obja, string1, string2) > > > >I get the following error: > >TypeError: toPrintString(): expected 0-2 args; got 3 > > Well, it works for me. I made some small changes: > > abstract public class fooBase { > public String toPrintString() { > return "here1"; > } > public String toPrintString(String initialIndent) { > return "here2"; > } > public String toPrintString(String initialIndent, String name) { > return "here3"; > } > abstract protected String toPrintString(java.lang.Object fooObj, > String initialIndent, String name); > } > > > public class foo extends fooBase { > protected String toPrintString(Object obj, > String initialIndent, String name) { > return "here4"; > } > } > > jython -Dpython.security.respectJavaAccessibility=false > Jython 2.0 on java1.3.0 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> import foo > >>> print foo().toPrintString(1, "string1", "string2") > here4 > >>> > > regards, > finn > |
From: <bc...@wo...> - 2001-01-22 22:37:39
|
[Chris Atkins] >I am running jython 2.0 release on hpux 11 with jdk1.2.2.07. > >I run my jython interpretter >with -Dpython.security.respectJavaAccessibility= 0 and =false. > >In both cases, I am unable to access protected methods of a class. > >I just switched out my jar file from using jpython1.1 to jython2.0, and it >works under under jpython1.1 > >My python code looks like the following: > >print foo.toPrintString(obja, string1, string2) > >I get the following error: >TypeError: toPrintString(): expected 0-2 args; got 3 Well, it works for me. I made some small changes: abstract public class fooBase { public String toPrintString() { return "here1"; } public String toPrintString(String initialIndent) { return "here2"; } public String toPrintString(String initialIndent, String name) { return "here3"; } abstract protected String toPrintString(java.lang.Object fooObj, String initialIndent, String name); } public class foo extends fooBase { protected String toPrintString(Object obj, String initialIndent, String name) { return "here4"; } } jython -Dpython.security.respectJavaAccessibility=false Jython 2.0 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import foo >>> print foo().toPrintString(1, "string1", "string2") here4 >>> regards, finn |
From: Chris A. <at...@nm...> - 2001-01-22 21:53:28
|
I am running jython 2.0 release on hpux 11 with jdk1.2.2.07. I run my jython interpretter with -Dpython.security.respectJavaAccessibility= 0 and =false. In both cases, I am unable to access protected methods of a class. I just switched out my jar file from using jpython1.1 to jython2.0, and it works under under jpython1.1 My python code looks like the following: print foo.toPrintString(obja, string1, string2) I get the following error: TypeError: toPrintString(): expected 0-2 args; got 3 My java code looks like the following: public class foo extends fooBase { protected String toPrintString(Object obj, String initialIndent, String name) { } } abstract public class fooBase { public String toPrintString() { } public String toPrintString(String initialIndent) { } public String toPrintString(String initialIndent, String name) { } abstract protected String toPrintString(java.lang.Object fooObj, String initialIndent, String name); } |
From: <bc...@wo...> - 2001-01-22 20:41:55
|
[Robert W. Bill] >Freezing servlet applications have resulted in difficulty with >the javaos module. The simple scenario is I need to use >os.stat(file), but all frozen applications return the error: > > AttributeError: class 'org.python.modules.os' has no attribute 'stat' > >When using jythonc, i've tried: > > jythonc -a -j app.jar jyDispatch.py > jythonc -a -j app.jar jyDispatch.py javaos os re string others... > jythonc -c -j app.jar jyDispatch.py javaos etc.... > jythonc -a -A c:\jython-2.0\lib\javaos -j app.jar jyDispatch.py os > >All result in the above AttributeError. > >I've assumed stat requires os + javaos- does it? Yes. >How do I freeze an application so that I can use it? When I just tried to freeze this little module I got an NPE: import os print os.stat This is an unintended sideeffect on a hack I added to satisfy site.py's use of the os module. It occur when sys.prefix is None which typically happens for frozen applications. Changing the module to: import sys sys.prefix = "." import os print os.stat and it runs as expected. I compiled the module with the simple: jythonc.bat -j app.jar -a app.py I'm not 100% sure this is the situation you are seeing, but please give it a try. regards, finn |
From: Robert W. B. <rb...@di...> - 2001-01-22 14:21:46
|
Freezing servlet applications have resulted in difficulty with the javaos module. The simple scenario is I need to use os.stat(file), but all frozen applications return the error: AttributeError: class 'org.python.modules.os' has no attribute 'stat' When using jythonc, i've tried: jythonc -a -j app.jar jyDispatch.py jythonc -a -j app.jar jyDispatch.py javaos os re string others... jythonc -c -j app.jar jyDispatch.py javaos etc.... jythonc -a -A c:\jython-2.0\lib\javaos -j app.jar jyDispatch.py os All result in the above AttributeError. I've assumed stat requires os + javaos- does it? How do I freeze an application so that I can use it? Which jythonc line above was closest? More on the servlet: I'm using Tomcat 3.2, Sun jdk 1.2.2, Win98 and Linux Context is jython and jython.jar + app.jar are in $TOMCAT_HOME/webapps/jython/WEB-INF/lib so that they can be *.war-ified easily. Thank you in advance for any suggestions. -Robert |
From: brian z. <bz...@zi...> - 2001-01-22 02:19:36
|
I would like to announce a new release of zxJDBC, the nearly 100% Python DB API 2.0 compliant interface for database connectivity in Jython. This release fixes any known bugs and adds a number of new features to the dbexts Python db wrapper script. It has been tested with the Jython 2.0 release and it is fully functional at this time. See the homepage at http://www.ziclix.com/zxjdbc for more information. Changes: - fixed a memory leak by ensuring statements and result sets are closed in finally blocks (thanks to Will Wohlman for pointing this out) - implemented callproc - added maxrows to raw and isql in dbexts - added preExecute and postExecute for DataHandler - forced a cast to String for InformixDataHandler on prepared statements when object is PyString - implemented nextset - updated dbexts.py to take advantage of the change thanks, brian |
From: Jack A. <ef...@bi...> - 2001-01-21 09:27:52
|
Ype Kingma wrote: > >It's only half-a-dozen source files at this stage -- a small job. I'll > >send you the source. > > Looking forward to it. Could you put it in a jar? Done -- see http://web.one.net.au/~effbiae/cyphon.html Jack. |
From: Jack A. <ef...@bi...> - 2001-01-20 05:59:27
|
Ype Kingma <yk...@xs...> wrote: > Sounds like you have doing the opposite of the java for python > jpe project. > python.dll: would this port to Unix? That is: is most of it > written in python? Did you perform reflection on the types > to get from jython to C? It's mostly Java with a bit of C glue code for JNI. It's an easy port to UNIX -- nothing but JNI and the Python API are called -- everything else is a bit of C or Java. > >Anyway, having proved to myself that I can get this far, I've lost > >motivation to complete it. If there's a demand for cyphon, I may polish > >it up a bit or if anyone can tell me the most convenient way to publish > >it, let me know. (it's only a few source files) > > I'm certainly interested in using it under Unix, but that will take > work. Would anyone have an idea how much? It's only half-a-dozen source files at this stage -- a small job. I'll send you the source. jack. |