До f.close()
вы должны wait()
для нашего подпроцесса.
def system_execute(self, command, path, out_file):
params_list = command.split(' ')
file_path = os.path.join(path, out_file)
f = open(file_path, "w")
sp = subprocess.Popen(params_list, stdout=f)
sp.wait()
f.close()
или просто
def system_execute(self, command, path, out_file):
params_list = command.split(' ')
file_path = os.path.join(path, out_file)
f = open(file_path, "w")
subprocess.call(params_list, stdout=f)
f.close()
(или, для упрощения обработки файлов,
[...]
with open(file_path, "w") as f:
subprocess.call(params_list, stdout=f)