L.S.
We are having issues with automation scripts that worked fine in ICD 7.5, but are now generating errors when executed in ICD 7.6.1.2
We have created a test script to reproduce the issue:
print "Start"
# Imports
from psdi.iface.router import HTTPHandler
from java.util import HashMap
from java.lang import String
from psdi.util.logging import MXLoggerFactory
from psdi.server import MXServer
# Other
import sys
print "Prepare import extra libraries"
# Maximo has libraries packaged in jython.jar; add this to sys.path to enable imports
try:
from org.python.util import PythonInterpreter
from java.lang.Object import getClass
JythonJarUri = getClass(PythonInterpreter()).getResource('/org/python/').getPath()
print "JythonJarUri:" + str(JythonJarUri)
# The uri is something like file:<path to jython.jar>!<resource within jython.jar>
# We need only the path
libs = str(JythonJarUri).split(':')[1].split('!')[0] + '/Lib/'
print "libs:" + str(libs)
print "sys.path:" + str(sys.path)
if not libs in sys.path:
sys.path.append(libs)
print "sys.path after append:" + str(sys.path)
except ImportError:
pass
print "Import extra library httplib (line32)"
import httplib # Needed http functions with better http response for determining what exactly has happened.
print "End"
When testing this script in 7.6.1.2 (on object WORELEASE with New Object), we get the following error:
AttributeError: type object 're' has no attribute 'compile' in <script> at line number 32
When we disable the import of httplib we get the following output:
Start
Prepare import extra libraries
JythonJarUri:file:/prj/IBM/WebSphere/AppServer/profiles/ctgAppSrv01/installedApps/ctgCell01/MAXIMOUI.ear/lib/jython.jar!/org/python/
libs:/prj/IBM/WebSphere/AppServer/profiles/ctgAppSrv01/installedApps/ctgCell01/MAXIMOUI.ear/lib/jython.jar/Lib/
sys.path:['__classpath__', '__pyclasspath__/', '/prj/ysm/shared/python/pylib']
sys.path after append:['__classpath__', '__pyclasspath__/', '/prj/ysm/shared/python/pylib', u'/prj/IBM/WebSphere/AppServer/profiles/ctgAppSrv01/installedApps/ctgCell01/MAXIMOUI.ear/lib/jython.jar/Lib/']
Import extra library httplib (line32)
End
I have found one entry on another IBM site that exactly describes this issue, however without a solution to resolve the issue:
www.ibm.com/mysupport/s/question/0D53p000092cNP9CAM/use-external-python-librariesAny help with this issue is greatly appreciated
Erwin
------------------------------
Erwin Hebing
------------------------------
#MaximoIntegrationandScripting#AssetandFacilitiesManagement#Maximo