How to run application with parameters in Python?

前端 未结 3 1579
礼貌的吻别
礼貌的吻别 2020-12-30 06:31

I need to run an application (binary file) and pass arguments using a Python code. Some arguments represent strings got during Python file processing.

for i          


        
3条回答
  •  既然无缘
    2020-12-30 07:03

    args = ['test. exe']
    subprocess.call(args, '-f')  //Error
    

    should be:

    args = ['test.exe', '-f']
    subprocess.call(args) 
    

    The command line argument should all be inside a single list for the first parameter of subprocess.call. The second argument to call is bufsize, which is supposed to be an integer (hence why you get the error you do)

提交回复
热议问题