Strange, simple Jython problem

Oliver Rutherfurd oliver at
Thu Feb 20 23:01:36 CET 2003

Hi Chris,

Just a stab, but are you trying to call instance methods of classes without
creating an instance of the class?

    Jython 2.1 on java1.4.1 (JIT: null)
    Type "copyright", "credits" or "license" for more information.
    >>> from java.lang import Math
    >>> print Math.random()
    >>> from java.util import Vector
    >>> print Vector.size()
    Traceback (innermost last):

      File "<console>", line 1, in ?

    TypeError: size(): expected 1 args; got 0

    >>> v = Vector()
    >>> print v.size()


Ollie Rutherfurd

"Clueless Chris" <chris at> wrote in message
news:<e9270fab.0302201242.4f10103f at>...
> Hi all,
> I'm an experienced Java guy who's messing around with Java a little. I
> can call regular Java classes just fine, such as Math.random() to get
> a random number -- the "Hello World" of Jython programs -- but calling
> my own classes, it complains that I'm an argument short. I get syntax
> errors saying "expecting 3 args; got 2", etc etc. I assume this is a
> 'this' issue, especially since when I try giving it a 3rd arg, it
> complains that my first arg, saying "self can't be coerced to" and
> then the type of the arg I tried to pass in.
> What's strange is that the normal JDK classes work fine.
> What am I missing here?
> Thanks,
> CC
> --

More information about the Python-list mailing list