[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #GCH-224785]: Create a Jython's library



Hi Aude-

> Thank you for the syntax correction.
> I modified the formula and do not have a syntax error message anymore.
> 
> However, when I try to display the image with the formula, I get this error:
> Creating display: Image Display
> org.python.core.PyException
> 
> Any idea where this can come from?

I'd need to see the rest of the error.  When the error dialog 
pops up, click the Support Form button, and fill
out the form.  That wil provide us the full error and
info that will let us track this down further.

Don Murray

> 2009/2/10 Unidata IDV Support <address@hidden>
> 
> > Hi Aude-
> >
> > > So I am trying to do a simple conversion of an image.
> > >
> > > In tools>formulas>Jython libraries, I have written this:
> > >
> > > def mod2temp(kmod):
> > > if (kmod > 176) :
> > >
> > > temp = 418.-float(kmod)
> > >
> > > else:
> > >
> > > temp = (660.-float(kmod))/2.
> > >
> > > return temp
> > >
> > > I get the following error message:
> > >
> > > "There was an error in the Python library:Traceback (innermost last):(no
> > > code object) at line 0 SyntaxError:("'return' outside
> > > function",('<string>',11,1,"))".
> > >
> > > what am I missing?
> >
> > The return has to be at the same indentation level as the if and else:
> >
> > def mod2temp(kmod):
> >      if (kmod > 176) :
> >         temp = 418.-float(kmod)
> >      else:
> >         temp = (660.-float(kmod))/2.
> >      return temp
> >
> >
> > Otherwise, return is outside the function mod2temp.
> >
> > Don Murray
> >
> > Ticket Details
> > ===================
> > Ticket ID: GCH-224785
> > Department: Support IDV
> > Priority: Normal
> > Status: Open
> >
> >
> 
> 


Ticket Details
===================
Ticket ID: GCH-224785
Department: Support IDV
Priority: Normal
Status: Closed