I'm using subprocess to open a unix executable, myapp, and pass an argument consisting of a file in .edf format, named sample.edf:
app=subprocess.Popen('/users/fishbacp/Desktop/myapp.app/Contents/MacOS/myapp
'+'/users/fishbacp/Desktop/sample.edf', shell=True)
This successfully launches the app and loads sample.edf. Various signal processing operations can be performed on sample.edf using a menu of options. At the end, I wish to perform one such menu option consisting of
Tools->Export as EDF ->Export.
Is there a means of modifying my subprocess command or introducing a new subprocess to accomplish this within my python script?
Using Python 3.7 and Mac OSX 10.15.4
shell=Trueis basically always a bad idea. You avoid serious security issues if you don't use it, and pass your application name and your argument as two separate list entries.subprocesshas no concept of "menus", or GUIs at all. If you want to script GUI operations, you'll need to use a library for the purpose, and the Python standard library doesn't ship with anything of that sort out-of-the-box.myappis truly your own application, perhaps you might build it a dedicated CLI entrypoint, so it can have components invoked without any GUI interaction needed at all?