Avatar of prreddy
prreddy
 asked on

Websphere Jython script

Hi,
i am working on Websphere and do most of the configuration settings and deployments using adminconsole. I would like to execute wsadmin commands using jython scripting...I created jython file and try to execute but i coudn't succeed...I am getting this exception...Appreciate if anyone help on this...


thanks,
-raj
import sys
#def list1(location, nodeName, serverName):
 
   # seting globals
   #--------------------------------------
   global AdminApp
   global AdminControl
   global AdminConfig
   global Help
 
    # checking 
   #--------------------------------------------------------------
   cellName = AdminControl.getCell()
   node = AdminConfig.getid("/Node:" + nodeName + "/")
   print "checking for existence of node " + nodeName
   if len(node) == 0:
      print "Error -- node not found for name " + nodeName
      return 
 
   # list the existing applications 
   #---------------------------------------------------------
   apps = AdminApp.list()
   print "Installed applications: "
   print apps
 
 ------------------------------------------
Exception:
------------------------------------------
WASX7015E: Exception running command: "execfile("list1.py")"; exception information:
 com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<input>", line 1, in ?
  File "list1.py", line 36
           global AdminApp
           ^
SyntaxError: invalid syntax

Open in new window

Java App Servers

Avatar of undefined
Last Comment
HonorGod

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
HonorGod

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
prreddy

ASKER
Excellent. it works fine...don't know why it didn't accept if you start at 2nd or 3rd column...
HonorGod

Whitespace is significant is Jython and the parent language Python.
Thanks for the grade & points.

Good luck & have a great day
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes