我试图做一个简单的脚本,并在 for 循环中抛出以下错误,
WASX7017E: Exception received while running file "/abc/websphere/wasad/createusers.py";
exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 22, in ?
AttributeError: __getitem__
filename=sys.argv[0]
file_read= open( filename) ---- this is line 22
for row in file_read:
请让我知道原因。
在这里你可以找到我的代码,
import sys
filename="/usr/websphere/onefolder/Userlist.txt"
fileread = open(filename, 'r')
for row in fileread:
column=row.strip().split(';')
user_name=column[0]
pass_word=column[1]
AdminTask.createUser(['-uid',user_name, '-password', pass_word, '-confirmPassword', pass_word])
AdminTask.mapUsersToAdminRole(['-roleName','Administrator','-userids',user_name])
AdminTask.addMemberToGroup('[-memberUniqueName user_name,o=defaultWIMFileBasedRealm -groupUniqueName cn=webarch,o=defaultWIMFileBasedRealm]')
fileread.close()
AdminConfig.save()
print 'Saving Configuration is completed'