Error in os.system () python [closed]

0

I have a python script that needs to run other software multiple times, I'm trying to do this using the .system ("command"), but this function always returns me -1 and it does not work, / p>

PS I'm using python 2.7

    
asked by anonymous 20.05.2014 / 18:20

1 answer

2

You can use another Python routine called subprocess.call .

It avoids many issues related to quotation marks and conventions between different operating system shells. The command is passed using a list, instead of a string, the first element being the command and the next parameters.

Example

import subprocess
subprocess.call(['Notepad.exe', 'C:\temp\test.txt'])
    
20.05.2014 / 18:44