0

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

4
  • 1
    Unrelated to your question, but shell=True is 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. Commented Feb 15, 2021 at 21:52
  • Related to your question, subprocess has 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. Commented Feb 15, 2021 at 21:52
  • If myapp is 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? Commented Feb 15, 2021 at 21:54
  • 1
    See Using Python in place of AppleScript -- though the answer boils down to "you can't". Commented Feb 15, 2021 at 22:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.