Thanks Andrea!
Now I understand it. I checked the Jython 2.5.2 which comes with the community
Python plugin for GeoServer 2.11.2. urllib2 is contained in Jython 2.5.2 but
requests not.
I found the latest Jython version is jython-2.7.0 which contains a lot more
native packages than Jython 2.5.2. Can I simply copy 2.7.0 to
"geoserver\WEB-INF\lib\" to replace the old 2.5.2?
Another question is how I can install custom packages that are neither part of
the native packages for Python nor Jython on GeoServer, e.g. "requests" and
"simplekml" etc.
Cheers,Alex
On Monday, 4 September 2017, 6:32:05 pm AEST, Andrea Aime
<[email protected]> wrote:
Hi Alex,GeoServer does not use the operating system python, but the Jython
scripting language,which runs fully in the JVM.As a result, you cannot use any
of the native packages.
I don't use Jython personally so cannot share experiences, but I've googled
aroundwith "jython, urllib2" and found this
page:http://www.jython.org/docs/library/urllib2.html
The documentation above is about Jython 2.5.2, the same version used by
GeoServer,hopefully it will be of use to you
CheersAndrea
On Mon, Sep 4, 2017 at 3:38 AM, Alex Chen via Geoserver-users
<[email protected]> wrote:
Dear all,
I am with GeoServer 2.11.2 and am planning to do some scripting on it.
I would like to run some custom Python scripts either as Apps that can be
called via http or as WPS services. I have managed to install the scripts
plugin on GeoServer, and the "apps" and "wps" folders are both visible in the
"scripts" parent folder.
I have tried to save some custom scripts in the apps folder and called via
http, for instance, "http://localhost:8090/ geoserver/script/apps/hello", but
it failed due to "unable to find packages". Those packages that GeoServer was
unable to find include "requests" and "urllib2" etc but I am pretty sure they
were both installed properly on the Python. I am wondering how GeoServer gets
to know where the Python (2.7.13) directory is and how Python gets utilised by
GeoServer on my computer via either http or wps.
I have posted some questions on stackoverflow, but haven't received much
positive reply.
Much appreciated!
Alex
------------------------------ ------------------------------ ------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
______________________________ _________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/ talks/foss4g.html#/
- The GeoServer user list posting guidelines: http://geoserver.org/comm/
userlist-guidelines.html
Geoserver-users@lists. sourceforge.net
https://lists.sourceforge.net/ lists/listinfo/geoserver-users
--
Regards,
Andrea Aime
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i
file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo
è consentito esclusivamente al destinatario del messaggio, per le finalità
indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne
il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di
procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro
sistema. Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse,
costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the
attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act (Legislative
Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in
accord with its purpose, any disclosure, reproduction, copying, distribution,
or either dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the intended
recipient, please contact immediately the sender by telephone, fax or e-mail
and delete the information in this message that has been received in error. The
sender does not give any warranty or accept liability as the content, accuracy
or completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users