Hi,

I tried Jython for the first time a few days ago and I
do really like it :D

There is however something that I do not understand:
everything starts with a simple file Test.py:

import java.lang

class Test(java.lang.Object):
    def __init__(self):
        "@sig public Dynamic()"
       
pass
    def
f(self):
        "@sig public int f()"
       
return 42

The code works without any pb in the Jython console:

bash-3.00$ jython
Jython 2.2b1 on java1.4.2_10 (JIT: null)
iType "copyright", "credits" or "license" for more information.
>>> import Test
>>> Test.Test().f()
42
>>>

Then I generate the java class for Test with jythonc

bash-3.00$ jythonc Test.py
[... skip...]
bash-3.00$ cd jpywork/

... and I add in jpywork a Main.java class to test the generated
Test.class bytecode:
public class Main {
    public static void main(String[] args) {
      Test test = new Test();
      System.out.println(test.f());
    }
}

The stuff works as expected:

bash-3.00$ javac Main.java
bash-3.00$ java Main
42

And again in the jpywork directory, with the Jython console:

Jython 2.2b1 on java1.4.2_10 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>>
>>> import Main
>>> Main.main([])
42
>>> import Test
>>> dir(Test)
['Test', '__doc__', '__file__', '__name__', 'java']
>>> Test.Test().f()
42
>>>

Here comes the part I don't understand: in the jpwork directory,
I run the Jython shell again, but I don't import Main and execute
Main.main, I try to use the Test module directly but it does
not work as it did previously:

bash-3.00$ jython
Jython 2.2b1 on java1.4.2_10 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> import Test
>>> dir(Test)
['__initProxy__', '__supernames__', 'classDictInit', 'clone', 'f', 'finalize', 'main', 'moduleDictInit']
>>> Test.f()
Traceback (innermost last):
  File "<console>", line 1, in ?
TypeError: f(): expected 1 args; got 0
>>> Test().f()
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: abstract method "f" not implemented


An explanation anyone ?

Cheers,

SB