Syntax error in my script

Discussion in 'Python' started by laredotornado, Jul 30, 2008.

  1. Hi,

    This might be more relevant for another group, but since this is a
    Python script, thought I'd start here. I'm trying to write a WLST
    script for WebLogic 9.2. I coped one directly from WebLogic's site
    (http://e-docs.bea.com/wls/docs90/config_scripting/
    using_WLST.html#1078952), but I'm getting errors. Specifically, I'm
    getting

    $HOSTNAME:"$PWD"->sh run_setup_cluster.sh

    Initializing WebLogic Scripting Tool (WLST) ...

    Welcome to WebLogic Server Administration Scripting Shell

    Type help() for help on available commands

    Problem invoking WLST - Traceback (innermost last):
    (no code object) at line 0
    File "/export/third-party/etsbea/home/etsbea/tests/npsconfig/
    createcluster.py", line 2
    from javax.management import *
    ^
    SyntaxError: invalid syntax


    Below is my script. I know nothing about Python but cutting and
    pasting from BEA's site isn't cutting it.

    ============Begin createcluster.py file=======================
    from java.util import *
    from javax.management import *
    import javax.management.Attribute

    print 'starting the script .... '

    connect('system','weblogic','t3://localhost:7001')
    clusters = "NPSCONFIG_GUI_Cluster"
    ms1 = {'managed1':7019:8020,'managed2':7020:8021}

    clustHM = HashMap()
    edit()
    startEdit()

    for c in clusters:
    print 'creating cluster '+c
    clu = create(c,'Cluster')
    clustHM.put(c,clu)
    cd('Clusters/' + c)
    set('MulticastAddress', '237.0.0.101')
    set('MulticastPort', 9200)
    set('WeblogicPluginEnabled', 'true')

    cd('..\..')

    clus1 = clustHM.get(clusters[0])

    for m, lp, ssl_lp in ms1.items():
    managedServer = create(m,'Server')
    print 'creating managed server '+m
    managedServer.setListenAddress('10.61.6.134')
    managedServer.setListenPort(lp)
    managedServer.setEnabled(0)
    cd('SSL/cgServer')
    managedServer.setEnabled(1)
    managedServer.setListenPort(ssl_lp)
    managedServer.setCluster(clus1)

    save()
    activate(block="true")
    disconnect()
    print 'End of script ...'
    exit()
    ==============End cretaecluster.py file=======================
    laredotornado, Jul 30, 2008
    #1
    1. Advertising

  2. laredotornado was kind enough to say:

    [cut]

    Indentation counts in Python. You're probably doing something wrong with
    whitespace/tab/carriage return.



    --
    Alan Franzoni <>
    -
    Remove .xyz from my email in order to contact me.
    -
    GPG Key Fingerprint:
    5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
    Alan Franzoni, Jul 30, 2008
    #2
    1. Advertising

  3. On Jul 30, 11:26 am, Alan Franzoni
    <> wrote:
    > laredotornadowas kind enough to say:
    >
    > [cut]
    >
    > Indentation counts in Python. You're probably doing something wrong with
    > whitespace/tab/carriage return.
    >
    > --
    > Alan Franzoni <>
    > -
    > Remove .xyz from my email in order to contact me.
    > -
    > GPG Key Fingerprint:
    > 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E


    That was it. Thanks, -
    laredotornado, Jul 30, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Balaji
    Replies:
    3
    Views:
    10,080
  2. Replies:
    7
    Views:
    576
    Lionel
    Oct 17, 2006
  3. Good Night Moon
    Replies:
    9
    Views:
    267
    Rick DeNatale
    Jul 25, 2007
  4. NewBie

    Makefile - perl script syntax error

    NewBie, Aug 24, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    123
    Josef Moellers
    Aug 24, 2005
  5. Mark Richards
    Replies:
    3
    Views:
    304
    Tad McClellan
    Nov 18, 2007
Loading...

Share This Page