Why is python no longer waiting for os.system to finish?

前端 未结 3 515
星月不相逢
星月不相逢 2020-12-11 03:29

I have the following function, which has been working great for months. I have not updated my version of Python (unless it happens behind the scenes?).

def         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-11 04:14

    This answer is a bit late. However, I had the same problem and subprocess didn't seem to work. I solved it by writing the command into a bash-file and executing the bash-file via python os.system:

    vi forPython.sh (write 'my command' into it)
    chmod +x forPython.sh
    

    (in Python script)

    os.system("./forPython.sh")
    

    This makes python wait for your process to finish.

提交回复
热议问题