Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3499182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:34:50+00:00 2026-05-18T12:34:50+00:00

In a py2app/Mac Application Bundle, is there a way to spawn another instance of

  • 0

In a py2app/Mac Application Bundle, is there a way to spawn another instance of same app from within the app, by passing different command line arguments?

or given a mac app bundle, how can I run it from command line and pass some arguments too?

Edit1:forking is a limited option, which may not work with 3rd party executables bundle with app+I need to run this on mac and windows.
Edit2: Question is how to run a a bundled python script using subprocess module

Details:

I am using py2app to generate a app bundle for my appilcation. My application has two parts

  1. MainApp: which is the UI
  2. BackgroundApp: a background process, which does the real job

Both MainApp and BackgroundApp have been implemented as python script and actually they are the same python script with different commandline e.g.

python myapp.py
python myapp.py --backgroundprocess

So when I run python myapp.py it automatically starts background process based on program path, but as I have now bundled my app as py2app I am not sure what executable I should be calling and passing --backgroundprocess option?

What I have tried

  1. $ open MyApp.app/ this opens the app but I can’t pass the arguments to it, as they will be arguments for open command and will not be passed to my app

  2. $ MyApp.app/Contents/MacOS/MyApp --backgroundprocess opens the app but not the backgroun process as it seems arguments are not being passed to app

also it throws 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 looks like it may not be possible
Launch an app on OS X with command line

open doesn’t except arguments.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:34:51+00:00Added an answer on May 18, 2026 at 12:34 pm

    Howto find cwd and execute an arbitrary supplied binary
    First place the binary in AppName.app/Contents/Resources then run this code from the python script:

    import subprocess
    process=subprocess.Popen((os.getcwd() + "/3rd_party_binary","--subprocess")) 
    process.poll() # is running?
    

    Howto properly spawn two version of your python app

    Fork is the old tried way to do this on MacOSX (unix)

    #!/usr/bin/env python
    import os, sys
    
    pid = os.fork()
    if pid:
        # we are the parent
        background_process.start()
        os.waitpid(pid, 0) # make sure the child process gets cleaned up
    else:
        # we are the child
        gui_app.start()
        sys.exit(0)
    
    print "parent: got it; text =", txt
    

    Multiprocessing in Python is apparently something that works on windows as well which I guess would be interesting to you(?).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use 'py2app' to generate a standalone application from some Python
I am building an application using py2app/setuptools, so once it creates application bundle I
I'm currently writing a small python app that embeds cherrypy and django using py2app.
I maintain a cross platform application, based on PyQt that runs on linux mac
i have a py2app application, which runs an appscript using py-appscript. the Applescript code
I'm trying to pack my Python app with py2app. I'm running the setup.py I
I'm trying to pack my Python app with py2app. I'm running the setup.py I
Does Apple accept Python applications for distribution on the new Mac App Store? If
I wrote a simple wxPython app which I package with py2app, turning it into
My company is working on an application that is half Qt/C++ for the editor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.