Re: Jython question: RealTupleType throws TypeException(components must be non-null)

  • To: Frank Gibbons <fgibbons@xxxxxxxxxxxxxxx>
  • Subject: Re: Jython question: RealTupleType throws TypeException(components must be non-null)
  • From: Tom Whittaker <tomw@xxxxxxxxxxxxx>
  • Date: Fri, 21 Jun 2002 13:23:42 -0500 (Central Daylight Time)
Hi Frank:

I pasted your lines into Curtis' editor, did a Command->Run and (after
saving the file) it ran fine (I added a "print func_t_tuple" at the end
to make sure).

I then 'un-commented' the section of your line:

    speed = getRealType("speed")#, SI.meter.divide(SI.second))

to make it:

    speed = getRealType("speed", SI.meter.divide(SI.second))

and _then_ speed is indeed returned as null when this is run via the
editor, so the exception is thrown.

I verified that this does work just fine in the command line window, and
as a stand-alone script.

On a whim, I closed the editor and opened it back up, and reloaded your
script (File->Open).  Then it ran just fine.  Hmmmm.

I restarted the editor and again pasted in your text, which (after
un-commenting as above) caused it to fail.  I then changed the name from
"speed" to "spee" and it also ran fine -- if I changed it back to
"speed" I got the exception you noted. looks like there is some problem with the name "speed" related
to the editor - have no ideas at this point, so I'll have to leave it to
Curtis to comment on.


On Fri, 21 Jun 2002, Frank Gibbons wrote:

> Dear VisADders,
> I'm working my way through the VisAD tutorial, with the help of Tom's
> Jython supplements, so I'm basically re-writing each one in Jython, which
> is astoundingly easy. Still, I'm getting stuck on example 2.7 ('new units
> and changing the line width'). This fragment is pretty much verbatim from
> the java code, but throws an exception:
> from visad import *
> from visad.python.JPythonMethods import *
> from visad.java2d import DisplayImplJ2D
> t = getRealType("time", SI.second)
> h = getRealType("height", SI.meter)
> speed = getRealType("speed")#, SI.meter.divide(SI.second))
> h_s_tuple = RealTupleType(h, speed)
> func_t_tuple = FunctionType(t, h_s_tuple)
> throws:
> Traceback (innermost last):
>    File "C:\VisADJython\", line 11, in ?
> visad.TypeException: TupleType: components must be non-null
>          at visad.TupleType.<init>(
>          at visad.RealTupleType.<init>(
> at the last line, where I call FunctionType(t, h_s_tuple). The really
> strange thing about this is that if I start up the Jython-VisAD command
> window, I can type in each line on its own without any problems like this.
> Any ideas?
> -Frank
> PhD, Computational Biologist,
> Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
> Tel: 617-432-3555       Fax:
> 617-432-3557

Tom Whittaker
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Telephone/VoiceMail:  608.262.2759