is it possible to use the AdminControl object in a Jython module?
It is available in the main-script but not in imported modules.
Do I've to add something in the scripts to access the AdminControl object in the modules?
Thx
global AdminTask, AdminConfig
Thanks
Anant
WASX7017E: Exception received while running file "/home/rpci182/bin/ebkWsadminProfile.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 76, in ?
File "/home/rpci182/bin/wsadmin.py/ebkUtils/ebkUtils.py", line 25, in showInfos
File "/home/rpci182/bin/wsadmin.py/ebkUtils/ebkUtils.py", line 57, in getCellid
NameError: AdminConfig
Related contents of ebkUtils.py:
global AdminApp, AdminConfig, AdminControl, AdminTask
def showInfos():
print "***** Willkommen im wsadmin *****"
cellid=getCellid()
def getCellid():
global AdminApp, AdminConfig, AdminControl, AdminTask
cellname=AdminConfig.showAttribute(AdminConfig.list("Cell"), "name")
varlist=AdminConfig.getid("/Cell:"+cellname+"/VariableMap:/")
entries=AdminConfig.show(varlist).split('[')[2].split(']')[0].split()
Brian
Up to now I only know 2 solutions/workarounds:
1. I don't use the OO-style of importing modules/methods etc. but I use execfile(PYTHONFILE)
2. I use import and classes and each class instance needs AdminApp, AdminConfig, AdminControl, AdminApp as parameters so that the class knows these objects and can use them.
In P/Jython there are only module-wide globals. So I miss something how I can access the AdminControl object in modules. The standard way would be to use __main__ which is not available ;-(
-----
WASX7017E: Exception received while running file "/home/rpci182/bin/ebkWsadminProfile.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 76, in ?
File "/home/rpci182/bin/wsadmin.py/ebkUtils/ebkUtils.py", line 25, in showInfos
File "/home/rpci182/bin/wsadmin.py/ebkUtils/ebkUtils.py", line 57, in getCellid
NameError: AdminConfig
ebkWsadminProfile.py:
from ebkUtils.ebkUtils import *
showInfos()
Problem is IBM have implemented their own version of Jython so it's
either their way or the highway.