5 Replies Latest reply on Sep 18, 2018 11:12 AM by handat

    wlst python start with parameter

    Tigryss

      Is it possible to use parameter(options or arg) for .py script under wlst? I would use optparser and start from command line

       

      java weblogic.WLST test.py -u user -p pass -h localhost -P Port etc....

        • 1. Re: wlst python start with parameter
          handat

          Of course that is possible. Check out the configureSecurityStore.py script that is part of the OAM/OIM post installation step for an example on how to use it and even as sample code.

          • 2. Re: wlst python start with parameter
            Tigryss

            Thank you Handat. Is there any other example, because we installed only WLS on our environment, and so the file is missing.

            • 4. Re: wlst python start with parameter
              Tigryss

              Hi Handat

               

               

              I try to use python argparse under wlst

               

               

              wls:/offline> import sys

              wls:/offline> sys.path.append("/usr/lib/python2.7")

              wls:/offline> print sys.path

              ['.', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.internal.thirdparty.jython.jar/Lib', '__classpath__', '/opt/weblogic/12.2.1.3/wlserver/server/lib/weblogic.jar', '/opt/weblogic/12.2.1.3/wlserver/common/wlst/modules/jython-modules.jar/Lib', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.scripting.jar/weblogic/management/scripting/utils/modules', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.scripting.jar/weblogic/management/scripting/core/utils/modules', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.scripting.jar/weblogic/management/scripting/utils/modules', '/opt/weblogic/12.2.1.3/wlserver/common/wlst', '/opt/weblogic/12.2.1.3/wlserver/common/wlst/lib', '/opt/weblogic/12.2.1.3/wlserver/common/wlst/modules', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.tools.migration.jar/wlstScriptDir', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.tools.migration.jar/wlstScriptDir/lib', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.tools.migration.jar/wlstScriptDir/modules', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.scripting.jar/wlstScriptDir', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.scripting.jar/wlstScriptDir/lib', '/opt/weblogic/12.2.1.3/wlserver/modules/com.oracle.weblogic.management.scripting.jar/wlstScriptDir/modules', '/opt/weblogic/12.2.1.3/oracle_common/modules/fmwplatform/common/fmwplatform-wlst-dependencies.jar/wlstScriptDir', '/opt/weblogic/12.2.1.3/oracle_common/modules/fmwplatform/common/fmwplatform-wlst-dependencies.jar/wlstScriptDir/lib', '/opt/weblogic/12.2.1.3/oracle_common/modules/fmwplatform/common/fmwplatform-wlst-dependencies.jar/wlstScriptDir/modules', '/usr/lib/python2.7']

              wls:/offline> import argparse

              Traceback (innermost last):

                File "<console>", line 1, in ?

                File "/usr/lib/python2.7/argparse.py", line 613

                                      yield subaction

                                            ^

              SyntaxError: invalid syntax

               

               

              and it's the same if I install jython2.7 ))

              • 5. Re: wlst python start with parameter
                handat

                I never tried that. Try getopt instead which should be in the classpath by default.