[Gvsig_english] Field Calculator: look for an expression saved in a file

Antonio Falciano afalciano at yahoo.it
Wed Dec 14 11:32:44 CET 2011


Il 13/12/2011 10.28, iaborsi ha scritto:
> Hi Antonio,
> thanks a lot! I've tried that: very easy, and it works perfectly!
> I take this opportunity to make an additional question: if in writing
> this Jython function I need additional Modules (typically an original
> group of functions defined by myself) which is the right path to save
> this stuff? I guess is the same directory from which I upload my Jython
> function, isn't it?
> To be clearer (following you example below): I want to modify your
> example script "conversion.py" in this way:
> -------
> from MyNewModule import *
>
> def m2tokm2(value):
> temp=value/1000000
> result = MyNewFunction(temp)
> return result
> -------
> where MyNewFunction() is defined within the module MyNewModule.
>
> I guess I have to save the module within the same path of conversion.py.
> Right?

Good idea, Iacopo! Importing further modules would extend the
potentiality of advanced expressions. It should be possible to import a
module within the same path, however it returns always a Jython
exception. Probably the simplest way to use other functions contained in
other module(s) consists in processing them before, even if it's not
pythonic at all.

Cheers,
Antonio

-- 
Antonio Falciano
http://www.linkedin.com/in/antoniofalciano


More information about the Gvsig_internacional mailing list