本文整理汇总了Python中subprocess.Popen.rfind方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.rfind方法的具体用法?Python Popen.rfind怎么用?Python Popen.rfind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subprocess.Popen
的用法示例。
在下文中一共展示了Popen.rfind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import rfind [as 别名]
def main(request):
if request.method == "POST":
value = 0
if request.path == "/users/login" or request.path == "/users/login/":
value = UsersModel().login(user=request.POST['user'],password=request.POST['password'])
elif request.path == "/users/add" or request.path == "/users/add/":
value = UsersModel().add(user=request.POST['user'],password=request.POST['password'])
if value > 0:
return HttpResponse(json.dumps({"errCode":1,"count":value}),content_type='application/json', status=200)
elif value < 0:
return HttpResponse(json.dumps({"errCode":value}),content_type='application/json', status=200)
if request.path =="/TESTAPI/resetFixture" or request.path =="/TESTAPI/resetFixture/":
return HttpResponse(json.dumps({"errCode":UsersModel().TESTAPI_resetFixture()}),content_type='application/json', status=200)
elif request.path == "/TESTAPI/unitTests" or request.path == "/TESTAPI/unitTests/":
results = Popen("python manage.py test Login".split(),stderr=PIPE,shell=False).communicate()[1]
char = results.rfind("Ran")+4
numTests = results[char:char+2]
echar = results.rfind("failures=")+7
if echar < 7:
numFailed = 0
else :
numFailed = results[echar:echar+1]
output = ""
return HttpResponse(json.dumps({"nrFailed":numFailed,"output":results,"totalTests":numTests}),content_type='application/json', status=200)
else:
return render_to_response('Login/client.html',{})
示例2: Popen
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import rfind [as 别名]
crab.crabSource = "source /etc/profile.d/set_globus_tcp_port_range.sh; export EDG_WL_LOCATION=/opt/edg "
# check GRID proxy
crab.checkGridProxy(0)
crab.checkCredentials(0)
# check setup
toCheck = ["scram","crab"]
for i in toCheck:
log.output("--> Checking if you have "+i+" in your path")
check = Popen("which "+i, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True).stdout.read()
if not check.rfind("no "+i+" in") == -1:
log.output(" ---> ERROR: you don't have "+i+" in your path, did you read the twiki instructions?")
if options.stdout:
print "Fatal ERROR, script exiting"
else:
print "Fatal ERROR, script exiting. Please consult "+logFileName+" for more information"
sys.exit(1)
if options.attach == None:
# now prepare our crab cfg
#print crabCfgName
crab.parseCRABcfg(timestamp,options.dir,crabCfgName)