I run into this error while trying to launch an application from my Mac by using subprocess command.
I tried this and it still working normally
import subprocess
appname = "Microsoft Word"
appname1 = appname + ".app"
subprocess.Popen(["open", "-n", "/Applications/" + appname1], stdout=subprocess.PIPE)
But however, when I applied it to my function. It said the file does not exist.
import re
import subprocess
def myCommand(command):
elif 'launch' in command:
reg_ex = re.search('launch(.*)', command)
if reg_ex:
appname = reg_ex.group(1)
appname1 = appname + ".app"
subprocess.Popen(["open", "-n", "/Applications/" + appname1], stdout=subprocess.PIPE)
And it returned like this:
Command: Launch Microsoft Word
The file /Applications/ microsoft word.app does not exist.
re.search('launch\s*(.*)'