Python string as file argument to subprocess

前端 未结 1 1426
感情败类
感情败类 2021-01-06 06:52

I am trying to pass a file to a program (MolPro) that I start as subprocess with Python.

It most commonly takes a file as argument, like this in console:

<         


        
相关标签:
1条回答
  • 2021-01-06 07:06

    It seems like your second method should work if you remove StdinCommand from the Popen() arguments:

    p = Popen(['/vol/thchem/x86_64-linux/bin/molpro'], shell = False, stdout = None, stderr = STDOUT, stdin = PIPE)
    p.communicate(input = StdinCommand)
    
    0 讨论(0)
提交回复
热议问题