I have a number of WLST scripts which all use a number of common functions I've written such as:
def offline_createManagedServer(Name, Port, ListenAddress):
This is called by createDomain.py
readTemplate('D:\\common\\bin\\osb1031' + '/wlserver_10.3/common/templates/domains/wls.jar')
common.offline_createManagedServer('ManagedServer1', '7001', 'localhost')
I have been attempting to use the instructions at:
Using the above code I get 'NameError: cd' at the first line in offline_createManagedServer --> cd('/')
I then created the wl.py and import that and now get a different error:
Error: No domain or domain template has been read.
Error: set() cannot be applied at this point of path
I want to keep all the common functions in a library style script file so they can be shared.
Has anyone actually got this to work?
I call the createDomain.py as follows:
java weblogic.WLST createDomain.py
Edited by: user10074087 on Dec 13, 2009 10:20 PM
In case anyone finds this useful, I ended up using:
jpythonScriptsDir = os.environ.get("SCRIPTS_PYTHON")
execfile(jpythonScriptsDir + '/common/' + 'import.py')
I run this at the start of all scripts that need access to the common functions.
execfile loads the definitions in import.py into the namespace that has all of the WLST functions.