How to run subprocess from Linux os to Python

Asked 1 years ago, Updated 1 years ago, 60 views

import subprocess

subprocess.run(['ls' , '-al'], shell = true)

I'm working on turning other external programs in Python using subprocess.

The external program I want to run is a device simulation program called SMARTSPICE

File name is 'testinverter.in' and

The command to enter on the Linux terminal is 'smartspice -b testinver.in -one newfile'.

I wonder how to write code with Python subprocess.

in my opinion

  run subprocess. ([' smart spice - b testinverter3.in - o newfile, '], shell true).

I wrote it in, but there is an error (I wrote it in the first column because I received the command directly)

I ask for your help.

python linux subprocess

2022-09-20 22:02

1 Answers

subprocess.run(['smartspice', '-b', 'testinverter3.in', '-o', 'newfile'], shell = True)

Would you like to run it like this?


2022-09-20 22:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.