Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.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
如何通过使用easygui选择测试,一个接一个地运行python脚本?_Python_Runtime Error_Main_Easygui_Execfile - Fatal编程技术网

如何通过使用easygui选择测试,一个接一个地运行python脚本?

如何通过使用easygui选择测试,一个接一个地运行python脚本?,python,runtime-error,main,easygui,execfile,Python,Runtime Error,Main,Easygui,Execfile,我正在使用下面的代码一个接一个地选择要运行的测试 from easygui import * import sys,os msg="Select following tests for testing" title="Test Selector" choices=["Test_case","Test_case2"] choice=multchoicebox(msg,title,choices) print choice msgbox("You have selected:"+str(cho

我正在使用下面的代码一个接一个地选择要运行的测试

from easygui import *
import sys,os

msg="Select following tests for testing"
title="Test Selector"
choices=["Test_case","Test_case2"]
choice=multchoicebox(msg,title,choices)


print choice
msgbox("You have selected:"+str(choice))
msg="Do you want to continue?"
title="Please confirm"
if ccbox(msg,title):
    pass
else:
    sys.exit(0)

def func():
    for tests in choice:
        print "tests",tests
    return tests
def main():

    execfile('python'+' ' +str( func())+'.py')

main()
现在,在选择测试之后,我想一个接一个地运行这些测试

IOError:[Errno 2]没有这样的文件或目录:“python Test\u case.py”


有人能帮我吗?

您不需要将
'python'
传递给文件名

execfile('Test_case.py')  # willl work
还是你的情况

execfile(str( func())+'.py')
看这里:


导入时为什么不使用instread exec?你应该去掉
“python”+”
tmp=importlib.import_模块(测试)如果我尝试使用它,它只运行第一个脚本,我如何让它运行所有脚本?如果我选择多个测试,它会尝试一个接一个地执行两个python脚本吗?