Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-AttributeError:index_Python_Indexing_Attributeerror - Fatal编程技术网

Python-AttributeError:index

Python-AttributeError:index,python,indexing,attributeerror,Python,Indexing,Attributeerror,我被困在这里 正在使用用户ID weblogic连接到t3://localhost:7001。。。 已成功连接到属于域“WLU服务器”的管理服务器“ExampleServer” 警告:连接到的协议不安全 服务器。为确保在线安全,SSL端口或 应改用管理端口 [MBeanServerInvocationHandler]com.bea:Name=mainWebApp,Type=AppDeployment 帕切利恩达战争 帕切利恩达 P 调用WLST-回溯(最里面的最后一个)时出现问题: 文件“D:

我被困在这里

正在使用用户ID weblogic连接到t3://localhost:7001。。。 已成功连接到属于域“WLU服务器”的管理服务器“ExampleServer”

警告:连接到的协议不安全 服务器。为确保在线安全,SSL端口或 应改用管理端口

[MBeanServerInvocationHandler]com.bea:Name=mainWebApp,Type=AppDeployment 帕切利恩达战争 帕切利恩达 P 调用WLST-回溯(最里面的最后一个)时出现问题: 文件“D:\RM Share\RM Scripts\wl\u deploy\u localhost-WC.py”,第30行,在? 属性错误:索引

我的代码如下所示:

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 you can specify the Complete Path of the "applications.txt" as well

print f
for i in range(5):
       line=f.readline()
       line1=line[:-4]
       line2=line1[:1]
       #check if the service or application is already present on the server...
       cd('AppDeployments')
       myapps=cmo.getAppDeployments()
       for 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
请告诉我,我哪里做错了


谢谢……

错误告诉您这行:

appName=dep_file[num1:num2]
这是错误的。您确定可以使用切片为
dep_文件
对象编制索引吗


也许你应该先在
dep_name
上调用
getName()

嘿,我对python非常陌生,不确定你指的是什么,我在博客上找到了一段代码,如下所示……我想根据我的要求使用和更新它……请帮助>>行='(仅限文字):婴儿里程碑

'>>>line.index(“B”)44>>>line.index(“但是它工作得很好,当我在commandlineHi Eli上传递相同的命令集时,谢谢你的建议,你是对的,我使用了下面提到的方法,并使它工作了..谢谢.appName=appLine.getName()