여러 번 실행하고 매번 다른 인수를 전달해야하는 프로그램이 있습니다.OSX : 앱의 여러 인스턴스 실행 및 명령 행 인수 전달
는import sys, os
from os.path import join
# This works, but will not launch twice
os.system('./AppName.app -AppCommandLineArg')
# This allows launching two instances but without command line arguments
os.system('open --new --background ./AppName.app')
# Attempt #1
os.system('open --new --background ./AppName.app -AppCommandLineArg')
# Attempt #2
os.system('open --new --background "./AppName.app -AppCommandLineArg"')
# Attempt #3
os.system('open --new --background "./AppName.app/Contents/MacOS/AppName -AppCommandLineArg"')
내가 '열기'사용하고 있는데 그 이유는 응용 프로그램에 여러 시간을 출시 할 수있을 것입니다 이렇게하려면 나는 다음과 같이 간단한 파이썬 스크립트를 작성했습니다. 올바른 명령을 '사용'하시겠습니까? 이 작업을 수행하는 방법에 대한 제안 사항은 무엇입니까? linux/mac으로 작업하는 것은 나에게 매우 새로운 것이다.
감사합니다.
p0 = subprocess.Popen(['./AppName.app/Contents/MacOS/AppName', '-AppCommandLineArg'])
p1 = subprocess.Popen(['./AppName.app/Contents/MacOS/AppName', '-AppCommandLineArg'])
건배 : -
편집 여기에 나를 위해 문제를 해결하는 코드입니다!
중복 : http://stackoverflow.com/questions/1308755/launch-an- app-on-os-x-with-command-line 또한 질문의 여러 부분에 대해서는 답변하지 않지만 도움을 줄 수는 있습니다. http://stackoverflow.com/questions/1081218/ideal-way-to- single-instance-apps-the-mac – psychotik