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: D-Man <ds...@ri...> - 2001-04-03 19:40:36
|
On Wed, Apr 04, 2001 at 04:24:21AM -0400, cindy wrote:
| >
| > class Foo :
| > def func( self ) :
| > print "func was called"
| >
| > def runme( self ) :
| > func() # this won't work as you've seen in your code
| >
| > def runme2( self ) :
| > self.func() # this will work as expected
|
| This I undertstand, but I don't see how "self" can be used on a
| class that is inherited and that is abstract, such as Component.
| When I do "self.enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)"
| I get an AttribueError on enableEvents, which I would expect.
| Thanks.
| Wayne
I see the problem now. The problem lies in enableEvents being
protected, and Jython's name mangling of it. First I'll explain a
little bit about inheritance, but I'll keep everything 'public' (like
in Python).
If I make a class,
class P :
def p_func( self ) :
pass
and a child class
class C( P ) :
pass
then try this
child_object = C()
dir( child_object )
I will see p_func as a member of child_object. This is because it is
inherited. If the parent class is 'abstract' that only means you
can't use 'new' on it. It has no effect on inheritance.
So with that knowledge, a class that inherits from java.awt.Component
should have a member 'enableEvents'. The problem here is it is
'protected'. In Java that means that only subclasses and classes in
the same package can access the function. Other classes can't call
it. Apparently jython does some name mangling on protected members by
prefixing "super__" to it. (I certainly hope it is mentioned in the
documentation, but like a <ahem> genius^H^H^H^H^H^Hidiot I haven't
checked ;-))
The following code worked for me :
from java.awt import Component , AWTEvent
class C( Component ) :
def __init__( self ) :
self.super__enableEvents( AWTEvent.WINDOW_EVENT_MASK )
I hope this clears up some confusion! As always ask again if you have
any more problems.
-D
|
|
From: D-Man <ds...@ri...> - 2001-04-03 19:33:23
|
(forwarded because it looks like a typo in the list address prevented the list from seeing this) ----- Forwarded message from cindy <inf...@pi...> ----- From: cindy <inf...@pi...> Date: Wed, 04 Apr 2001 04:24:21 -0400 To: D-Man <ds...@ri...> Cc: Jyt...@li... X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-22 i686) > > class Foo : > def func( self ) : > print "func was called" > > def runme( self ) : > func() # this won't work as you've seen in your code > > def runme2( self ) : > self.func() # this will work as expected This I undertstand, but I don't see how "self" can be used on a class that is inherited and that is abstract, such as Component. When I do "self.enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)" I get an AttribueError on enableEvents, which I would expect. Thanks. Wayne ----- End forwarded message ----- |
|
From: D-Man <ds...@ri...> - 2001-04-03 19:18:40
|
Through a small piece of stupid code, I found a bug in the Jython 2.0
compiler.
In a function (in a class, in a module if it matters) I had the
following code :
del some_var
Originally some_var existed (a temporary local), but though some
modifications some_var no longer existed. Trying to run the app
yielded the following (partial) result :
./run.bash Main.py
Traceback (innermost last):
File "Main.py", line 33, in ?
File "SessionTests\__init__.py", line 25, in ?
java.lang.NullPointerException
at org.python.compiler.CodeCompiler.Name(Compiled Code)
at org.python.parser.SimpleNode.visit(Compiled Code)
at org.python.compiler.CodeCompiler.del_stmt(CodeCompiler.java:470)
at org.python.parser.SimpleNode.visit(Compiled Code)
at org.python.compiler.CodeCompiler.suite(Compiled Code)
at org.python.parser.SimpleNode.visit(Compiled Code)
at org.python.compiler.CodeCompiler.parse(Compiled Code)
... (very long stack trace)
at org.python.core.PyTableCode.call(Compiled Code)
at org.python.core.Py.runCode(Py.java:1055)
at org.python.core.__builtin__.execfile(__builtin__.java:288)
at org.python.core.__builtin__.execfile(__builtin__.java:292)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:155)
at org.python.util.jython.main(jython.java:159)
java.lang.NullPointerException: java.lang.NullPointerException
Obviously the error was on my part (can't del a var that DNE), but the
compiler should give a more informative error message (;-)). Maybe it
should wait and give a NameError during exection, since it is possible
that I created the name through exec() or something. (I didn't use
any fancy dynamism in this case)
I just checked against CPython and found this:
>>> def foo( ):
... del dne
...
>>> foo()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "<stdin>", line 2, in foo
UnboundLocalError: Local variable 'dne' referenced before assignment
>>>
All of this is on a Win2k box. Version 2.0 for both python
interpreters, jdk1.1.8 for the jvm.
If you want any more info just yell ;-).
-D
|
|
From: D-Man <ds...@ri...> - 2001-04-03 18:19:04
|
The change you need to make is shown below.
In Java, C++ and Eiffel, member functions can be called on the current
object without specifying the object. In Python, however, the object
(usually named 'self' but called 'this' in Java and C++, 'current' in
Eiffel) must be explicitly named.
The following 2 runme functions in java code are equivalent, and serve the
same purpose as the python function following it.
public class Foo
{
public void func( )
{
System.out.println( "func was called" ) ;
}
public void runme( )
{
func() ;
}
public void runme2( )
{
this.func() ;
}
}
class Foo :
def func( self ) :
print "func was called"
def runme( self ) :
func() # this won't work as you've seen in your code
def runme2( self ) :
self.func() # this will work as expected
Conclusion :
As you read through sample Java code, prepend "this" (for java) or
"self" (for python) to each method call on the current object.
IMO explicit is better than implicit so I use 'this' in all my
Java code where it won't be illegal (ie nested event handler
classes)
HTH,
-D
On Wed, Apr 04, 2001 at 02:14:38AM -0400, cindy wrote:
| Here is the code for SketchFrame.
|
| from javax import swing
| import java
| import java.awt.event
|
| class SketchFrame(swing.JFrame):
| def __init__(self, title):
| // some code left out - it build a menu bar
| enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)
self.enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)
^^^^^
|
| def processWindowEvent(self, event):
| if (event.getID() == java.awt.event.WindowEvent.WINDOW.CLOSE):
| java.awt.event.dispose() # not sure if this works
| yet. I haven't gotten to this point.
| java.awt.System.exit(0)
| swing.JFrame.super.processWindowEvent(event)
|
|
|
From: cindy <inf...@pi...> - 2001-04-03 17:10:58
|
The code is not exactly the same as the book.
In Sketcher.py I have-
import java
from SketchFrame import *
class Sketcher:
def __init__(self):
true = 1
title = 'sketcher'
self.aSketchFrame = SketchFrame(title)
self.theKit = self.aSkechFrame.getToolkit()
self.wndSize = setBounds(self.wndSize.width/4,
self.wndSize.height/4,
self.wndSize.width/2,
self.wndSize.height/2)
self.aSketchFrame.setVisible(true)
if __name__ == '__maine__'
aSketcher = Sketcher()
Here is the code for SketchFrame.
from javax import swing
import java
import java.awt.event
class SketchFrame(swing.JFrame):
def __init__(self, title):
// some code left out - it build a menu bar
enableEvents(java.awt.event.WindowEvent.WINDOW_EVENT_MASK)
def processWindowEvent(self, event):
if (event.getID() == java.awt.event.WindowEvent.WINDOW.CLOSE):
java.awt.event.dispose() # not sure if this works
yet. I haven't gotten to this point.
java.awt.System.exit(0)
swing.JFrame.super.processWindowEvent(event)
> On Tue, Apr 03, 2001 at 10:21:29PM -0400, cindy wrote:
> | Hi again,
> | If I may reiterate what you said to help me understand.If module Foo.py
> | has the statement "enableEvents(AWTEvent.WINDOW_EVENT_MASK)" and
> | module Bar.py does a composite on module Foo.py, then I have to pass
> | the instance name to module Foo.py to qualify the method enableEvents()
> | thus
> | "instanceName.enableEvents(). If this is so how do I pass the instance
> | name
> | in the creation of the instance? If I have the statement in Bar.py
> | "self.myInstance = Foo().
> | Thanks.
> | Wayne
>
> I'm not sure if I completely understand your goals and your design.
> Also, I think you mixed up modules and classes in your description
> above.
>
> I just read the docs for java.awt.Component.enableEvents( long ) and
> noticed the following :
>
> This method only needs to be invoked by subclasses of
> Component which desire to have the specified event types
> delivered to processEvent regardless of whether or not a
> listener is registered.
>
> Are you trying to create a subclass of Component that needs to receive
> events even if no listeners are registered? Could you post some code
> showing what it is you are currently trying to do?
>
> If you have a class Foo that inherits from component, you could do
> something like the following, but I'm not sure if it is what you are
> looking for.
>
> ---- in some .py file ------
> import java
>
> class Foo( java.awt.Component ) :
> def __init__( self ) :
> # note that 'self' now refers the the instance of 'Foo' and
> # therefore is-a instance of 'Component'
> self.enableEvents( java.awt.AWTEvent.WINDOW_EVENT_MASK )
>
> def processEvent( self , event ) :
> """
> @sig protected void processEvent( java.awt.AWTEvent event )
>
> this method must be defined or you will end up with errors
> when the event dispatcher tries to call it
> """
>
> print "Found an event!"
> print event
>
> HTH,
> -D
>
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> http://lists.sourceforge.net/lists/listinfo/jython-users
|
|
From: Kent J. <kjo...@tr...> - 2001-04-03 16:51:30
|
Here is a complete test case. When using the first showData in
MyCallback, it works. With the second callback (as below) it gives
Traceback (innermost last):
File "<console>", line 1, in ?
File "./Project/Test.py", line 12, in ?
TypeError: showData() takes at least 3 arguments (2 given)
Note: If it matters, I am running this from inside the command
interpreter using execfile('Test.py', globals()) (because I am on a
Mac, no command line).
Kent
// Test.java
package test;
public class Test
{
public static class Data {
public String name;
public int value;
}
public static class Callback {
public void showData(Data inData) {
showData(inData.name, inData.value);
}
public void showData(String inName, int inValue)
{ /* empty */ }
}
public static void testData(Callback inCallback)
{
Data data = new Data();
data.name = "This is a test";
data.value = 3;
inCallback.showData(data);
}
}
# Test.py
from test import Test
class MyCallback(Test.Callback):
# def showData(self, inData):
# print inData.name
# print inData.value
def showData(self, inName, inValue):
print inName
print inValue
Test.testData(MyCallback())
|
|
From: DITTGEN P. <pie...@cr...> - 2001-04-03 16:16:25
|
>
> The code is on line 11 of os.java, which is included in your
> distribution,
> so you can look at the file and get an exact answer to what
> failed and why.
>
> Ben
Thanks Ben.
The code at line 11 in os.java is:
public static String __file__ =
Py.getSystemState().prefix.toString() + "/Lib/javaos.py";
Is getSystemState() method returning a null value?
Is prefix attribute null?
But why, is there a reference to javaos.py?
Do I need the jython libs as jython scripts (i.e. not as class files)
to make my prog run?
Pierre
|
|
From: Ben H. <Ben...@fi...> - 2001-04-03 16:03:24
|
The stack trace shows that the jython library was present. Consider the
evidence:
> java.lang.ExceptionInInitializerError: java.lang.NullPointerException
> at org.python.modules.os.<clinit>(os.java:11)
ExceptionInInitializerError means that some code running when the 'os' class
loaded into the JVM, (possibly in a "static{}" code block), threw a null
pointer exception.
The code is on line 11 of os.java, which is included in your distribution,
so you can look at the file and get an exact answer to what failed and why.
Ben
----- Original Message -----
From: "Garcia, Michael" <mg...@Bu...>
To: "'DITTGEN Pierre '" <pie...@cr...>;
<jyt...@li...>
Sent: Tuesday, April 03, 2001 3:23 PM
Subject: RE: [Jython-users] Generated java classes dependency
> Hi Pierre,
> I believe you are correct. You must have the jython.jar on your delivery
> platform. This is not unlike trying to write servlets or some other java
> app. You need to have the supporting libs on the system it will run on.
>
> The jython app you are delivering is dependent on the jython distribution.
> Would it be possible to distribute jython with you jar?
>
> regards,
> Mick
>
> -----Original Message-----
> From: DITTGEN Pierre
> To: jyt...@li...
> Sent: 3/30/01 7:26 AM
> Subject: [Jython-users] Generated java classes dependency
>
> Hello,
>
> I'm quite new to jython, i find it very powerful as a script language.
> But at this time, I have a problem to make an independant jar from a
> jython
> script.
> I use Jython 2.0, with SUN JDK1.3.0 on Win2000 Pro.
>
> My script is called dir.py and contains:
> == begin ======
> import os
>
> for file in os.listdir('.'):
> print file
> == end ========
>
> It works well as I use the command line:
> jython dir.py
> (it shows me the list of the files of the current directory)
>
> I want to build a jar file from this script.
> I used this command :
> jythonc -a -j dir.jar dir.py
> It created a jar file (called dir.jar) which contains normally all the
> needed jython libraries
> needed to make it run.
> But as I want to run it, using the command
> java -jar dir.jar
> I got an exception :
> == begin ==============
> Java Traceback:
>
> at org.python.core.Py.JavaError(Py.java:238)
> at org.python.core.PyTableCode.call(PyTableCode.java:159)
> at org.python.core.imp.createFromCode(imp.java:157)
> at org.python.core.Py.runMain(Py.java:798)
> at dir.main(dir.java:61)
> Traceback (innermost last):
> File "C:\Documents\src\jython\test\dir.py", line 0, in main
> java.lang.ExceptionInInitializerError: java.lang.NullPointerException
> at org.python.modules.os.<clinit>(os.java:11)
> at java.lang.reflect.Method.invoke(Native Method)
> at org.python.core.PyJavaClass.initialize(PyJavaClass.java:108)
> at
> org.python.core.PyJavaClass.lookupGivingClass(PyJavaClass.java:666)
> at org.python.core.PyClass.lookup(PyClass.java:164)
> at
> org.python.core.PyJavaClass.__findattr__(PyJavaClass.java:712)
> at org.python.core.PyObject.__getattr__(PyObject.java:670)
> at dir$_PyInner.main$1(dir.java:43)
> at dir$_PyInner.call_function(dir.java:28)
> at org.python.core.PyTableCode.call(PyTableCode.java:155)
> at org.python.core.imp.createFromCode(imp.java:157)
> at org.python.core.Py.runMain(Py.java:798)
> at dir.main(dir.java:61)
>
> java.lang.ExceptionInInitializerError:
> java.lang.ExceptionInInitializerError
> == end ================
>
> I solved the problem giving the root dir of jython installation as a
> system
> property:
> java -Dpython.home=c:\dev\jython-2.0 -jar dir.jar
>
> But it annoys me...
> Is the generated jar (dir.jar) still dependant of the jython
> installation ?
> Does it mean that it can't run on a workstation having only JRE
> installed ?
> If not, please help me to find out the thing or the option I missed.
>
> Thanks
> Pierre
> --
> Pierre Dittgen, software engineer
> CRIL Telecom software
> E-mail: pie...@cr...
> Phone: (33) 1 58 17 04 64
>
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> http://lists.sourceforge.net/lists/listinfo/jython-users
>
>
|
|
From: DITTGEN P. <pie...@cr...> - 2001-04-03 15:58:40
|
> > Hi Pierre, > I believe you are correct. You must have the jython.jar on > your delivery platform. This is not unlike trying to write > servlets or some other java app. You need to have the > supporting libs on the system it will run on. > > The jython app you are delivering is dependent on the jython > distribution. Would it be possible to distribute jython with > you jar? > > regards, > Mick > That's I would like to know... Has anyone already tried to deploy a standalone jython app (without additional Jython installation)? Thanks Pierre |
|
From: Garcia, M. <mg...@Bu...> - 2001-04-03 14:31:04
|
Hi Pierre,
I believe you are correct. You must have the jython.jar on your delivery
platform. This is not unlike trying to write servlets or some other java
app. You need to have the supporting libs on the system it will run on.
The jython app you are delivering is dependent on the jython distribution.
Would it be possible to distribute jython with you jar?
regards,
Mick
-----Original Message-----
From: DITTGEN Pierre
To: jyt...@li...
Sent: 3/30/01 7:26 AM
Subject: [Jython-users] Generated java classes dependency
Hello,
I'm quite new to jython, i find it very powerful as a script language.
But at this time, I have a problem to make an independant jar from a
jython
script.
I use Jython 2.0, with SUN JDK1.3.0 on Win2000 Pro.
My script is called dir.py and contains:
== begin ======
import os
for file in os.listdir('.'):
print file
== end ========
It works well as I use the command line:
jython dir.py
(it shows me the list of the files of the current directory)
I want to build a jar file from this script.
I used this command :
jythonc -a -j dir.jar dir.py
It created a jar file (called dir.jar) which contains normally all the
needed jython libraries
needed to make it run.
But as I want to run it, using the command
java -jar dir.jar
I got an exception :
== begin ==============
Java Traceback:
at org.python.core.Py.JavaError(Py.java:238)
at org.python.core.PyTableCode.call(PyTableCode.java:159)
at org.python.core.imp.createFromCode(imp.java:157)
at org.python.core.Py.runMain(Py.java:798)
at dir.main(dir.java:61)
Traceback (innermost last):
File "C:\Documents\src\jython\test\dir.py", line 0, in main
java.lang.ExceptionInInitializerError: java.lang.NullPointerException
at org.python.modules.os.<clinit>(os.java:11)
at java.lang.reflect.Method.invoke(Native Method)
at org.python.core.PyJavaClass.initialize(PyJavaClass.java:108)
at
org.python.core.PyJavaClass.lookupGivingClass(PyJavaClass.java:666)
at org.python.core.PyClass.lookup(PyClass.java:164)
at
org.python.core.PyJavaClass.__findattr__(PyJavaClass.java:712)
at org.python.core.PyObject.__getattr__(PyObject.java:670)
at dir$_PyInner.main$1(dir.java:43)
at dir$_PyInner.call_function(dir.java:28)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.imp.createFromCode(imp.java:157)
at org.python.core.Py.runMain(Py.java:798)
at dir.main(dir.java:61)
java.lang.ExceptionInInitializerError:
java.lang.ExceptionInInitializerError
== end ================
I solved the problem giving the root dir of jython installation as a
system
property:
java -Dpython.home=c:\dev\jython-2.0 -jar dir.jar
But it annoys me...
Is the generated jar (dir.jar) still dependant of the jython
installation ?
Does it mean that it can't run on a workstation having only JRE
installed ?
If not, please help me to find out the thing or the option I missed.
Thanks
Pierre
--
Pierre Dittgen, software engineer
CRIL Telecom software
E-mail: pie...@cr...
Phone: (33) 1 58 17 04 64
_______________________________________________
Jython-users mailing list
Jyt...@li...
http://lists.sourceforge.net/lists/listinfo/jython-users
|
|
From: D-Man <ds...@ri...> - 2001-04-03 14:29:07
|
On Tue, Apr 03, 2001 at 10:21:29PM -0400, cindy wrote:
| Hi again,
| If I may reiterate what you said to help me understand.If module Foo.py
| has the statement "enableEvents(AWTEvent.WINDOW_EVENT_MASK)" and
| module Bar.py does a composite on module Foo.py, then I have to pass
| the instance name to module Foo.py to qualify the method enableEvents()
| thus
| "instanceName.enableEvents(). If this is so how do I pass the instance
| name
| in the creation of the instance? If I have the statement in Bar.py
| "self.myInstance = Foo().
| Thanks.
| Wayne
I'm not sure if I completely understand your goals and your design.
Also, I think you mixed up modules and classes in your description
above.
I just read the docs for java.awt.Component.enableEvents( long ) and
noticed the following :
This method only needs to be invoked by subclasses of
Component which desire to have the specified event types
delivered to processEvent regardless of whether or not a
listener is registered.
Are you trying to create a subclass of Component that needs to receive
events even if no listeners are registered? Could you post some code
showing what it is you are currently trying to do?
If you have a class Foo that inherits from component, you could do
something like the following, but I'm not sure if it is what you are
looking for.
---- in some .py file ------
import java
class Foo( java.awt.Component ) :
def __init__( self ) :
# note that 'self' now refers the the instance of 'Foo' and
# therefore is-a instance of 'Component'
self.enableEvents( java.awt.AWTEvent.WINDOW_EVENT_MASK )
def processEvent( self , event ) :
"""
@sig protected void processEvent( java.awt.AWTEvent event )
this method must be defined or you will end up with errors
when the event dispatcher tries to call it
"""
print "Found an event!"
print event
HTH,
-D
|
|
From: cindy <inf...@pi...> - 2001-04-03 13:17:52
|
Hi again,
If I may reiterate what you said to help me understand.If module Foo.py
has the statement "enableEvents(AWTEvent.WINDOW_EVENT_MASK)" and
module Bar.py does a composite on module Foo.py, then I have to pass
the instance name to module Foo.py to qualify the method enableEvents()
thus
"instanceName.enableEvents(). If this is so how do I pass the instance
name
in the creation of the instance? If I have the statement in Bar.py
"self.myInstance = Foo().
Thanks.
Wayne
D-Man wrote:
> In Java everything is coded as part of a class. As an example class
> take this :
>
> public class Foo
> {
> public void func1( )
> {
> System.out.println( "Hello from func1" ) ;
> }
>
> static public void func2( )
> {
> System.out.println( "Hello from func1" ) ;
> }
> }
>
> This class contains 2 methods, func1 and func2. func2 is declared as
> static. That means that the following (Java) code is legal :
>
> Foo.func2() ;
> Foo f = new Foo() ;
> f.func2()
> f.func1()
>
> while the following is illegal :
>
> Foo.func1() ;
>
> The reason is that only "static" members belong to the _class_, all
> others belong to _instances_ of the class. In order to call the
> method you must first have an instance of java.awt.Component and call
> it on the instance. Note also that it will only affect the instance
> you call it on, not all instances of the class.
>
> Python's classes don't have any "static" members because Python
> doesn't force you to write everything inside of a class construct.
> Instead put "static" functions in the module. (If you are trying to
> use a mix of Java and Python then the java code is unable to access
> module level stuff unless it goes through the interpreter directly)
>
> -D
|
|
From: <nik...@va...> - 2001-04-03 09:12:55
|
Hi, I agree; this has potential. A quick question though; is it possible somehow to map these kinds of *.py-servlets in turn to retrieve requests (e.g. *.xml) - like with regular (or compiled jython- ) servlets? regards Niklas -----Original Message----- From: Brian Zhou [mailto:bri...@ya...] Sent: Wednesday, March 28, 2001 9:19 PM To: Jyt...@li... Subject: [Jython-users] jython servlet wiki Here's some info on how to setup and use jython servlet: http://jywiki.sourceforge.net/index.php?JythonServlet and http://jywiki.sourceforge.net/index.php?JythonServletImaging for another example. Notice it's a wiki [http://jywiki.sourceforge.net/index.php?WikiWikiWeb], so you're encouraged to add stuff to the site. So far, I really enjoy writing jython servlet. Excellent work from the jython-developers. Combined with XMLC from http://xmlc.enhydra.org it feels even cleaner than JSP. Let's share and promote the use of Jython Servlet! /bzhou _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
|
From: Robert W. B. <rb...@di...> - 2001-04-02 16:44:40
|
Hello all, I have a question about the builtins chr(). The Python Library Reference for 2.1b2 says it "Return a string of one character whose ASCII code is the integer i, e.g., chr(97) returns the string 'a'. This is the inverse of ord(). The argument must be in the range [0..255], inclusive; ValueError will be raised if i is outside that range." When interpreting this for Jython, the obvious catches are that it specifies "range [0..255]", and raises ValueError for i outsite this range. This doesn't really seem to apply considering how Jython only has the 2-byte character string. Different behavior for Jython's builtin chr() makes sense. However, is this difference in chr() official? I didn't see a comment on http://jython.sourceforge.net/docs/differences.html about this, and I wanted to be sure before committing it to paper for a Jython publication (and risking a ValueError being raised in Jython2.1final or 2.2). Here's code in case I don't make any sense above: CPython: >>>chr(256) Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: chr() arg not in range(256) Jython: >>>chr(256) u'\u0100' Thanks, Robert |
|
From: Kent J. <kjo...@tr...> - 2001-04-02 16:26:17
|
Hello,
I am having a problem in Jython-2.1a1 subclassing a Java class that
has overloaded methods.
The setup is a little complicated.
I have a Java class SortedProperties with a nested class
IteratorCallback. IteratorCallback has these two methods:
class IteratorCallback {
public void startLanguagePair(SortedProperties.LanguagePair inPair)
{
// Forward to two-argument version
startLanguagePair(inPair.text, inPair.userClass);
}
public void startLanguagePair(String inName, String inUserClass)
{
// Default implementation does nothing
}
}
SortedProperties has a method iterate(IteratorCallback, boolean) that
calls the one-argument startLanguagePair.
I am using this in a jython servlet using PyServlet. Here is the
callback class:
class Titlelister(SortedProperties.IteratorCallback):
def __init__(self, inPage):
self.page = inPage
def startLanguagePair(self, inPair):
self.page.add(Heading(2, inPair.text))
# def startLanguagePair(self, inText, inUserClass):
# self.page.add(Heading(2, inText))
This version, using the one-argument startLanguagePair, works fine.
If I comment out the first startLanguagePair and uncomment the second
one, I get the error
File ".\FileBase\jython\TitleTest.py", line 28, in doGet
TypeError: startLanguagePair() takes at least 3 arguments (2 given)
line 28 is
sortedProps.iterate(Titlelister(page), 0)
It looks like the jython call mechanism is missing the base class
method somehow.
I'm not sure if I am doing something wrong or if there is a bug here.
Kent Johnson Transparent Language, Inc.
kjo...@tr... http://www.transparent.com
|
|
From: Nick C. <ni...@sr...> - 2001-03-30 21:28:22
|
Okay, I figured out why this didn't work. Need to actually
call the function.
so "def func():\n\tprint 'hello'\nfunc()";
Nick
On Fri, Mar 30, 2001 at 02:36:43PM -0600, Nick Collier wrote:
> Hi,
>
> Can someone tell me why the code below doesn't print hello.
>
> public class EmbedTest {
>
> private String func = "def func():\n\tprint 'hello'";
>
> public void run() {
>
> // NullPointerException without creating an interpreter
> // need to initialize the runtime?
> // better way to do this?
> PythonInterpreter i = new PythonInterpreter();
> PyCode code = __builtin__.compile(func, "<string>", "exec");
>
> System.out.println(code.__class__);
> System.out.println(code.__dir__());
> System.out.println(code.__getattr__("co_argcount"));
> System.out.println(code.__getattr__("co_varnames"));
> PyStringMap locals = new PyStringMap();
>
> //Py.exec(code, locals, locals);
> Py.runCode(code, locals, locals);
> }
>
> public static void main(String[] args) {
> try {
> EmbedTest test = new EmbedTest();
> test.run();
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
> }
>
> The compile call returns a PyTableCode object but the call to Py.runCode
> doesn't have any noticeable results.
>
> thanks,
>
> Nick
>
> --
> Nick Collier
> Social Science Research Computing
> University of Chicago
> http://repast.sourceforge.net
>
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> http://lists.sourceforge.net/lists/listinfo/jython-users
--
Nick Collier
Social Science Research Computing
University of Chicago
http://repast.sourceforge.net
|
|
From: <Ron...@Ne...> - 2001-03-30 21:03:11
|
The JPython interpreter understands a property (if set) called python.path. This is described in the Jython web docs (look for Registry or Properties). If you provide that property, then it treats that path as its search path when looking for JPython source code (...it's the classpath of JPython files...). Around here, we make up our own batch files that mimic jython.bat, adding the properties on the command line. If you have a lot of properties, then you want to use the Registry. We prefer the batch files because we want to convert environment variables into properties (the real system info gets converted into the form Java wants, which is why Jython wants certain properties set up if you want related behavior). Brad Buchsbaum <bbu...@ar...>@lists.sourceforge.net on 03/30/2001 12:55:46 PM Sent by: jyt...@li... To: <jyt...@li...> cc: Subject: [Jython-users] caling jython scripts on Windows ME Hi all, Just curious if anyone knows of a way I can set things up on a Windows ME box so that I can call a Jython script with out including the entire path (when the script is on the system path). Currently, I have to provide te entire path of a script even if it is on the system path. This is not the case for Windows 2000, which has the convenient PATHEXT variable. Nor on Unix, of course. thanks, Brad Buchsbaum _______________________________________________ Jython-users mailing list Jyt...@li... http://lists.sourceforge.net/lists/listinfo/jython-users |
|
From: Nick C. <ni...@sr...> - 2001-03-30 20:35:21
|
Hi,
Can someone tell me why the code below doesn't print hello.
public class EmbedTest {
private String func = "def func():\n\tprint 'hello'";
public void run() {
// NullPointerException without creating an interpreter
// need to initialize the runtime?
// better way to do this?
PythonInterpreter i = new PythonInterpreter();
PyCode code = __builtin__.compile(func, "<string>", "exec");
System.out.println(code.__class__);
System.out.println(code.__dir__());
System.out.println(code.__getattr__("co_argcount"));
System.out.println(code.__getattr__("co_varnames"));
PyStringMap locals = new PyStringMap();
//Py.exec(code, locals, locals);
Py.runCode(code, locals, locals);
}
public static void main(String[] args) {
try {
EmbedTest test = new EmbedTest();
test.run();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The compile call returns a PyTableCode object but the call to Py.runCode
doesn't have any noticeable results.
thanks,
Nick
--
Nick Collier
Social Science Research Computing
University of Chicago
http://repast.sourceforge.net
|
|
From: Brad B. <bbu...@ar...> - 2001-03-30 17:55:49
|
Hi all, Just curious if anyone knows of a way I can set things up on a Windows ME box so that I can call a Jython script with out including the entire path (when the script is on the system path). Currently, I have to provide te entire path of a script even if it is on the system path. This is not the case for Windows 2000, which has the convenient PATHEXT variable. Nor on Unix, of course. thanks, Brad Buchsbaum |
|
From: Nick C. <ni...@sr...> - 2001-03-30 16:45:22
|
Hi,
I'm trying to use Jython as a scripting language within an ide. The
ide is for developing simulations with a Java framework, and the
scripting is for scripting simulation behavoir (not ide behavoir).
Ideally, I'd want the user to define a Java class through the ide and
have the behavoir of such a class defined in python. Of course,
there's lots of wrapping etc. going on here, but I'm thinking of
generating bytecode whose source code would look something like
the following:
public class MyAgent {
private PyFunction step;
private int wealth = 0;
public void step() {
step.__call(...);
}
}
where the PyFunction step has the wealth ivar available to it.
The PyFunction would be the result of compiling whatever the user entered
into the ide, for example:
if wealth > 3:
do_something()
else:
do_something_else()
My question then is, is this possible? And if so, how do I create a
PyFunction object and ensure that its namespace / calling frame contains
the appropriate mappings - so that in the above example the PyFunction
has the current value for wealth.
Alternatively, I suppose I could treat the Java class as a
proxy for a PyClass, so that any calls on the Java class are forwarded
to the PyClass so:
public void setWealth(int val) {
target.__setattr__("wealth", new PyInteger(val));
}
Perhaps the PyClass should be a PyInstance here though.
At any rate, the question remains given some jython source code how
can I get a PyFunction, PyClass, or PyInstance from within a
Java application.
thanks very much,
Nick
ps. If this is all woefully wrong-headed, any suggestions would
be appreciated.
n.
--
Nick Collier
Social Science Research Computing
University of Chicago
http://repast.sourceforge.net
|
|
From: DITTGEN P. <pie...@cr...> - 2001-03-30 12:28:02
|
Hello,
I'm quite new to jython, i find it very powerful as a script language.
But at this time, I have a problem to make an independant jar from a jython
script.
I use Jython 2.0, with SUN JDK1.3.0 on Win2000 Pro.
My script is called dir.py and contains:
== begin ======
import os
for file in os.listdir('.'):
print file
== end ========
It works well as I use the command line:
jython dir.py
(it shows me the list of the files of the current directory)
I want to build a jar file from this script.
I used this command :
jythonc -a -j dir.jar dir.py
It created a jar file (called dir.jar) which contains normally all the
needed jython libraries
needed to make it run.
But as I want to run it, using the command
java -jar dir.jar
I got an exception :
== begin ==============
Java Traceback:
at org.python.core.Py.JavaError(Py.java:238)
at org.python.core.PyTableCode.call(PyTableCode.java:159)
at org.python.core.imp.createFromCode(imp.java:157)
at org.python.core.Py.runMain(Py.java:798)
at dir.main(dir.java:61)
Traceback (innermost last):
File "C:\Documents\src\jython\test\dir.py", line 0, in main
java.lang.ExceptionInInitializerError: java.lang.NullPointerException
at org.python.modules.os.<clinit>(os.java:11)
at java.lang.reflect.Method.invoke(Native Method)
at org.python.core.PyJavaClass.initialize(PyJavaClass.java:108)
at
org.python.core.PyJavaClass.lookupGivingClass(PyJavaClass.java:666)
at org.python.core.PyClass.lookup(PyClass.java:164)
at org.python.core.PyJavaClass.__findattr__(PyJavaClass.java:712)
at org.python.core.PyObject.__getattr__(PyObject.java:670)
at dir$_PyInner.main$1(dir.java:43)
at dir$_PyInner.call_function(dir.java:28)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.imp.createFromCode(imp.java:157)
at org.python.core.Py.runMain(Py.java:798)
at dir.main(dir.java:61)
java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError
== end ================
I solved the problem giving the root dir of jython installation as a system
property:
java -Dpython.home=c:\dev\jython-2.0 -jar dir.jar
But it annoys me...
Is the generated jar (dir.jar) still dependant of the jython installation ?
Does it mean that it can't run on a workstation having only JRE installed ?
If not, please help me to find out the thing or the option I missed.
Thanks
Pierre
--
Pierre Dittgen, software engineer
CRIL Telecom software
E-mail: pie...@cr...
Phone: (33) 1 58 17 04 64
|
|
From: D-Man <ds...@ri...> - 2001-03-29 20:42:21
|
On Thu, Mar 29, 2001 at 06:01:55PM +0000, Finn Bock wrote: | [assert/raise on tuples or on exprs] | | I can't quite find head or tail in this discussion, but I think that the | conclusions are wrong. I think you got it all ;-). | The "assert" statement allow for one or for two expresion as arguments. | You are allow to make that single expresion a 2-tuple, but I bet that it | doesn't do what you wanted it to do: | ... | >>> assert 0, "message" | Traceback (innermost last): | File "<console>", line 1, in ? | AssertionError: message | >>> assert (0, "message") | >>> | | Notice that the last assert didn't throw an AssertionError and it never | will. Hmm, oops. Thanks! | I'll also like to set straight that there are IMO *not* any conflict in | the grammar or language def about the optional comma in the assert | statement and the tuple creating comma in the atom production. Given that last example, there no longer seems to be a conflict. I was mistakenly thinking that assert ( expr , "message" ) was identical to assert expr , "message" which led to the confusion with the documentation. -D |
|
From: <bc...@wo...> - 2001-03-29 18:42:32
|
I forgot about the raise statement. Here there are a difference between CPython and Jython. In Cpython, the first argument (the type) can be tuple and CPython will then unpack the first value of the tuple as the type and it will unpack like this repeatedly. Python 2.1b2 (#12, Mar 23 2001, 14:01:30) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> raise (((IndexError, 45), 1), 3), 56 Traceback (most recent call last): File "<stdin>", line 1, in ? IndexError: 56 >>> This tuple unpacking isn't done by Jython where the entire first expression is used as the exception type: Jython 2.1a1 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> raise (((IndexError, 45), 1), 3), 56 Traceback (innermost last): File "<console>", line 1, in ? (((<class exceptions.IndexError at 5352464>, 45), 1), 3): 56 >>> This is a real difference between the python implementations, but there is AFAICT no ambiguity. The raise statement expect 0, 1, 2 or 3 expressions and the expressions can *not* be replaced by a 0, 1, 2 or 3-tuple. regards, finn |
|
From: <bc...@wo...> - 2001-03-29 18:04:25
|
[assert/raise on tuples or on exprs] I can't quite find head or tail in this discussion, but I think that the conclusions are wrong. The "assert" statement allow for one or for two expresion as arguments. You are allow to make that single expresion a 2-tuple, but I bet that it doesn't do what you wanted it to do: Jython 2.1a1 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> assert 1 >>> assert 0 Traceback (innermost last): File "<console>", line 1, in ? AssertionError: >>> assert 0, "message" Traceback (innermost last): File "<console>", line 1, in ? AssertionError: message >>> assert (0, "message") >>> Notice that the last assert didn't throw an AssertionError and it never will. I'll also like to set straight that there are IMO *not* any conflict in the grammar or language def about the optional comma in the assert statement and the tuple creating comma in the atom production. regards, finn |
|
From: <bc...@wo...> - 2001-03-29 18:03:52
|
[Kent Johnson]
>I am trying out PyServlet using Jetty 2, a web server that implements
>the 2.1 servlet spec, and I have a little problem.
>
>The value of request.getServletPath() is different in 2.1 and 2.2 in
>a way that breaks PyServlet. Under 2.1, when the servlet is matched
>by an extension match, getServletPath() returns null. Under 2.2, it
>returns the entire path through the matched extension.
>
>The Servlet 2.1 spec says,
>
>public String getServletPath();
>[snip]
>If the servlet was invoked by some other mechanism than by a path
>match (such as
>an extension match), then this method returns null.
>
>whereas the 2.2 spec has the example
>
>Servlet Mapping Pattern: *.jsp
>Servlet: JSPServlet
>/catalog/help/feedback.jsp ContextPath: /catalog
>ServletPath: /help/feedback.jsp
>PathInfo: null
>
>To make PyServlet work with Jetty I changed line 108 to read
> spath = ((HttpServletRequest) req).getServletPath() +
>((HttpServletRequest) req).getPathInfo();
I don't understand how this patch can work. To me that ends up with
values like
spath = "null/help/feedback.py"
or
spath = "/help/feedback.pynull"
depending on which getter that reurned null.
>i think this will work under both 2.1 and 2.2, though I have not
>tested it with 2.2.
I would rather do something like this, if that works for you:
spath = ((HttpServletRequest) req).getServletPath();
if (spath == null) {
// Servlet1.1 puts thr path of an extension-matched
// servlet in PathInfo.
spath = ((HttpServletRequest) req).getPathInfo();
}
regards,
finn
|