Can I ask you what your development environment looks like when you tested
the python scripting hooks and then I can recreate it here?  Again the
javascript hook works it's just the python hook.

 

What version of geoserver?

What version of the python hook?

What Application Server?

 

Etc.

 

Thanks

Dom

 

From: Justin Deoliveira [mailto:jdeol...@opengeo.org] 
Sent: Wednesday, February 27, 2013 7:27 AM
To: Bessette-Halsema, Dominique E
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] python scripting hook

 

Thanks Dominique. I wonder if Java 7 might be the issue, i know from time to
time things are found not to work with it, it could be something in
javax.script that has changed. Or perhaps something related to invokedynamic
that was added in java 7.

 

It would interesting if you could try on java 6 to see if the problem still
exists, that way we can at least rule it out. 

 

 

On Sun, Feb 24, 2013 at 1:54 PM, Bessette-Halsema, Dominique E
<dominique.besse...@gdit.com> wrote:

Hi

 

i just updated my VM to java1.7, geoserver 2.2.4 and the python scripting
hook from http://gridlock.opengeo.org/geoserver/master/community-latest/ 

 

I unzip the contents of the python scripting zip file to my
geoserver/WEB-INF/lib directory and restarted the server.  

I see the created scripts/wps folders under my geoserver data dir, and added
the buffer.py file from the example page
http://docs.geoserver.org/stable/en/user/community/scripting/hooks.html
under the wps folder and made sure it had the correct permissions.  

I do not see the the py:buffer in the WPS get capabilities document
http://localhost:8080/geoserver/ows?service=wps
<http://localhost:8080/geoserver/ows?service=wps&version=1.0.0&request=GetCa
pabilities> &version=1.0.0&request=GetCapabilities  but I do see it under
the WPS Request Builder dropdown which is odd.

 

 

When I try to run the wps via the following rest call and when I hit the
py:buffer wps in the dropdown on the WPS builder request page i see the
following error in the geoserver logs:

http://localhost:8080/geoserver/wps?service=WPS
<http://localhost:8080/geoserver/wps?service=WPS&version=1.0.0&request=Execu
te&identifier=py:buffer&datainputs=geom=POINT%280%200%29@mimetype=applicatio
n/wkt;distance=10>
&version=1.0.0&request=Execute&identifier=py:buffer&datainputs=geom=POINT%28
0%200%29@mimetype=application/wkt;distance=10 

 

 

Caused by: java.io.IOException: javax.script.ScriptException: ImportError:
No module named types in
/h/data/gis/geoserver/external/scripts/wps/buffer.py at line number 1
        at
org.geoserver.script.ScriptFileWatcher.parseFileContents(ScriptFileWatcher.j
ava:58) [script-core-2.4-SNAPSHOT.jar:2.4-SNAPSHOT]
        at
org.geoserver.script.ScriptFileWatcher.parseFileContents(ScriptFileWatcher.j
ava:26) [script-core-2.4-SNAPSHOT.jar:2.4-SNAPSHOT]
        at org.geoserver.platform.FileWatcher.read(FileWatcher.java:53)
[platform-2.2.4.jar:]
        at
org.geoserver.script.ScriptFileWatcher.readIfModified(ScriptFileWatcher.java
:44) [script-core-2.4-SNAPSHOT.jar:2.4-SNAPSHOT]
        at
org.geoserver.script.wps.ScriptProcess.getInputs(ScriptProcess.java:69)
[script-core-2.4-SNAPSHOT.jar:2.4-SNAPSHOT]
        at
org.geoserver.script.wps.ScriptProcessFactory.getParameterInfo(ScriptProcess
Factory.java:119) [script-core-2.4-SNAPSHOT.jar:2.4-SNAPSHOT]
        ... 79 more
Caused by: javax.script.ScriptException: ImportError: No module named types
in /h/data/gis/geoserver/external/scripts/wps/buffer.py at line number 1
        at
org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:191)
[jython-2.5.2.jar:]
        at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
[jython-2.5.2.jar:]
        at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:47)
[jython-2.5.2.jar:]
        at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
[rt.jar:1.7.0]
        at
org.geoserver.script.ScriptFileWatcher.parseFileContents(ScriptFileWatcher.j
ava:56) [script-core-2.4-SNAPSHOT.jar:2.4-SNAPSHOT]
        ... 84 more
Caused by: Traceback (most recent call last):
  File "/h/data/gis/geoserver/external/scripts/wps/buffer.py", line 1, in
<module>
    from geoserver.wps import process
  File "__pyclasspath__/geoserver/wps.py", line 1, in <module>


ImportError: No module named types

at org.python.core.Py.ImportError(Py.java:290) [jython-2.5.2.jar:]
        at org.python.core.imp.import_first(imp.java:750)
[jython-2.5.2.jar:]
        at org.python.core.imp.import_name(imp.java:834) [jython-2.5.2.jar:]
        at org.python.core.imp.importName(imp.java:884) [jython-2.5.2.jar:]
        at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
[jython-2.5.2.jar:]
        at org.python.core.PyObject.__call__(PyObject.java:357)
[jython-2.5.2.jar:]
        at org.python.core.__builtin__.__import__(__builtin__.java:1173)
[jython-2.5.2.jar:]
        at org.python.core.imp.importOne(imp.java:903) [jython-2.5.2.jar:]
        at geoserver.wps$py.f$0(__pyclasspath__/geoserver/wps.py:35)
        at geoserver.wps$py.call_function(__pyclasspath__/geoserver/wps.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
[jython-2.5.2.jar:]
        at org.python.core.PyCode.call(PyCode.java:18) [jython-2.5.2.jar:]
        at org.python.core.imp.createFromCode(imp.java:386)
[jython-2.5.2.jar:]

..........................

 

 

Heres the buffer.py contents

 

from geoserver.wps import process
from com.vividsolutions.jts.geom import Geometry

@process(
  title='Buffer',
  description='Buffers a geometry',
  inputs={
    'geom': (Geometry, 'The geometry to buffer'),
    'distance':(float,'The buffer distance')
  },
  outputs={
    'result': (Geometry, 'The buffered geometry')
  }
)
def run(geom, distance):

  return geom.buffer(distance);

 

The python scripting app directory works.  If I add a hello world app under
data_dir/scripts/apps/hello/main.py  and hit it via a rest call I see the
correct output.  Although I had to create the apps directory myself the
python scripting hook created a functions directory.  So it just seems that
its the wps python scripting function that isnt working.

 

Do I need to add a geoserver.wps jar to the lib directory under
data_dir/scripts/lib ?

Do I need to add geoscript python jars?  http://geoscript.org/py/

 

Thank You 

Dominique

 

  _____  

From: Justin Deoliveira [jdeol...@opengeo.org]
Sent: Thursday, February 07, 2013 8:26 AM


To: Bessette-Halsema, Dominique E
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] python scripting hook

 

Hmmm... ok. What version of Geoserver and the scripting extension are you
running?

 

On Wed, Feb 6, 2013 at 5:50 PM, Bessette-Halsema, Dominique E
<dominique.besse...@gdit.com> wrote:

It looks like this.  It's the same one as the example
http://docs.geoserver.org/stable/en/user/community/scripting/hooks.html

 

from geoserver.wps import process

from geoscript.geom import Geometry

 

@process(

   title='Buffer',

   description='Buffers a geometry',

   inputs={'geom': (Geometry, 'The geometry to buffer'),

           'distance':(float,'The buffer distance')},

   outputs={'result': (Geometry, 'The buffered geometry')}

)

def run(geom, distance):

  return geom.buffer(distance)

 

Thank You

Dom

 

From: Justin Deoliveira [mailto:jdeol...@opengeo.org] 
Sent: Monday, February 04, 2013 8:06 AM
To: Bessette-Halsema, Dominique E
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] python scripting hook

 

Hmmm... any chance you can make the script available, I can take a closer
look. 

 

On Fri, Feb 1, 2013 at 8:49 AM, Bessette-Halsema, Dominique E
<dominique.besse...@gdit.com> wrote:

Hi 

 

I'm having trouble installing the python scripting hook.  I unzip the
contents of geoserver-2.2-SNAPSHOT-python-plugin.zip into my
geoserver-2.2/WEB-INF/lib file.  In my GEOSERVER_DATA_DIR is see a
scripts/lib and scripts/function directory.  I created a scripts/wps
directory and made the buffer.py example from
http://docs.geoserver.org/stable/en/user/community/scripting/hooks.html 

 

When I go into the WPS request builder and try to run the buffer.py script I
see the following error in geoserver.

 

15:46:38,593 ERROR [org.apache.wicket.RequestCycle] (http--0.0.0.0-8080-1)
java.io.IOException: javax.script.ScriptException: ImportError: No module
named types in /gis/geoserver/external/scripts/wps/demo.py at line number 1:
java.lang.RuntimeException: java.io.IOException:
javax.script.ScriptException: ImportError: No module named types in
/gis/geoserver/external/scripts/wps/demo.py at line number 1

 

Line number 1 is 

 

from geoserver.wps import process

 

what am I missing?

 

Thank you


----------------------------------------------------------------------------
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users





 

-- 
Justin Deoliveira

OpenGeo - http://opengeo.org

Enterprise support for open source geospatial.





 

-- 
Justin Deoliveira 

OpenGeo - http://opengeo.org

Enterprise support for open source geospatial.





 

-- 
Justin Deoliveira

OpenGeo - http://opengeo.org

Enterprise support for open source geospatial.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to