indexing - Python - AttributeError: index -
i stuck here...
connecting t3://localhost:7001 userid weblogic ... connected admin server 'examplesserver' belongs domain 'wl_server'.
warning: insecure protocol used connect server. ensure on-the-wire security, ssl port or admin port should used instead.
[mbeanserverinvocationhandler]com.bea:name=mainwebapp,type=appdeployment parcelliendata.war parcelliendata p problem invoking wlst - traceback (innermost last): file "d:\rm-share\rm-scripts\wl_deploy_localhost-wc.py", line 30, in ? attributeerror: index
my code looks like:
import sys import getopt import os loadproperties(sys.argv[1] +".props") connect(username,password,adminurl) cmd = "awk -f'name=' '{print $2}' | awk -f',' '{print $1}'" f = open(r'./applicationslist.txt','r') #in above line can specify complete path of "applications.txt" print f in range(5): line=f.readline() line1=line[:-4] line2=line1[:1] #check if service or application present on server... cd('appdeployments') myapps=cmo.getappdeployments() dep_file in myapps: print depfile print line print line1 print line2 num1=depfile.index(line2) print num1 num2=depfile.index(",", num1) print num2 appname=depfile[num1:num2] print appname if appname == "line1": print redeploy elif appname != "line1": print "not deploying" continue else: print deploying
please advice, going wrong....
thanks....
the error tells line:
appname=dep_file[num1:num2]
is wrong. sure dep_file
object can indexed slice?
maybe should call getname()
on dep_name
first?
Comments
Post a Comment