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.

So....it 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.

tom



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\example2_07.py", line 11, in ?
> visad.TypeException: TupleType: components must be non-null
>          at visad.TupleType.<init>(TupleType.java:58)
>          at visad.RealTupleType.<init>(RealTupleType.java:171)
>
> 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       http://llama.med.harvard.edu/~fgibbons
>
>

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




  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: