I'm trying to use a Jython automation script in Maximo 7.6.1.1:
from psdi.iface.router import HTTPHandler
from java.util import HashMap
from java.util import String
handler = HTTPHandler()
map = HashMap()
map.put("URL",url)
map.put("HTTPMETHOD","GET")
responseBytes = handler.invoke(map,None)
response = String(responseBytes,"utf-8")
Source: Maximo 76 Scripting Features (PDF download)
However, I'm getting an error at line 3:
ImportError: cannot import name String in <script> at line number 3
I can isolate the error by deleting everything except line 3:
from java.util import String
-------------------------------------------------------------------
ImportError: cannot import name String in <script> at line number 1
Why can't I import String
from java.util
into my Jython script?
Because it is java.lang.String
.
There is no String
in java.util
.