Search code examples
pythonweblogicwlst

Why does Python (WLST) tell me a documented function doesn't exist?


I'm using the Weblogic Scripting Tool aka WLST, a Python-based shell environment, to programmatically edit variables in Plan.xml files for projects to be deployed to the Weblogic server. I can get as far as getting an instance of the WLSTPlan Object, and can run getVariables and other methods to check that it is populated and view its contents. However, when I try to call the setVariable method, I get an AttributeError, which to my limited understanding means the method doesn't exist:

wls:/UoADevDomain/serverConfig> plan.setVariable("foo", "bar")
Traceback (innermost last):
  File "<console>", line 1, in ?
AttributeError: setVariable

As the docs linked above (which I checked are the right version) show, this method definitely should exist, and other methods listed in the same doc work. I'm not sure if this is an issue with Weblogic or with my understanding of Python, but either way it's beyond me. I tried using the dir() function to list the plan object's attributes, but it returned an empty set so I guess that trick doesn't work in this environment.

Can anyone suggest how to go about diagnosing this problem, or better still fixing it?


Solution

  • Using javap and looking for setters on the WLSTPlan bean shows only the following setter

    void setVariableValue(java.lang.String, java.lang.String);
    

    Could be a typo in the docs. Can you try 'setVariableValue' instead.