In the py2app / Mac application package, is there a way to create another instance of the same application from the application by passing different command line arguments?
or given the Mac app package, how can I run it from the command line and pass some arguments?
Edit1: forking is a limited option that may not work with a package of third-party executables with the + application. I need to run this on Mac and Windows.
Edit2: The question is how to run the associated python script using the subprocess module
Details:
I am using py2app to create an application package for my appilcation. My application is in two parts
- MainApp: user interface
- BackgroundApp: a background process that does the real work
Both MainApp and BackgroundApp are implemented as a python script, and in fact they are the same python script with a different command line, for example.
python myapp.py python myapp.py --backgroundprocess
Therefore, when I run python myapp.py , it automatically starts the background process based on the path to the program, but since I now connected my application as py2app, I'm not sure which executable I need to call and pass the --backgroundprocess parameter?
What i tried
$ open MyApp.app/ this opens the application, but I can not pass arguments to it, since they will be arguments for an open command and will not be passed to my application
$ MyApp.app/Contents/MacOS/MyApp --backgroundprocess opens the application, but not the backgroun process, because it seems that the arguments are not passed to the application
he also gives an error
Traceback (most recent call last): File "/Users/agyey/projects/myapp/release4.26/py2exe/dist/MyApp.app/Contents/Resources/run.py", line 4, in <module> from renderprocess import RenderEngineApp File "renderprocess/RenderEngineApp.pyc", line 6, in <module> File "wx/__init__.pyc", line 45, in <module> File "wx/_core.pyc", line 4, in <module> File "wx/_core_.pyc", line 18, in <module> File "wx/_core_.pyc", line 11, in __load ImportError: dlopen(/Users/agyey/projects/myapp/release4.26/py2exe/dist/MyApp.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so, 2): Library not loaded: @executable_path/../Frameworks/libwx_macud-2.8.0.dylib Referenced from: /Users/agyey/projects/myapp/release4.26/py2exe/dist/MyApp.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so Reason: Incompatible library version: _core_.so requires version 7.0.0 or later, but libwx_macud-2.8.0.dylib provides version 2.6.0
Conclusion: It seems that it is impossible to Run the application in OS X with the command line
open contains no arguments.