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

  • SEARCH
  • Home
  • 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 8203857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:42:16+00:00 2026-06-07T07:42:16+00:00

So I have a nice python app for OS X that is working great.

  • 0

So I have a nice python app for OS X that is working great. It runs an external terminal script and I would like to include that in with my python app. Ideally, I’d be able to run py2app and have this script bundled up with it into the executable and then be able to include it and run it in the python portion of my code. Is this possible?

Thanks in advance!

Extra Edit: The script that I am using is compiled. I can’t just look inside and paste it.

  • 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-06-07T07:42:17+00:00Added an answer on June 7, 2026 at 7:42 am

    See http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#option-reference and look at the –resources parameter. For example:

    python setup.py py2app --resources foo
    

    If this were a shell script, that would be a perfectly valid thing to do. For a binary executable, it’s a bit more hacky. First, p2app’s documentation clearly says “not for code!”. Second, the OS X documentation says not to put executables in the Resources directory. The main reason for this is code signing: the default settings “seal” everything in Resources as part of the main app’s signature, but separate executables are not supposed to be sealed that way, they’re supposed to be signed separately.

    However, all that being said, it will still work. Except that it probably won’t end up with +x permissions, so after your py2app step, you’ll have to “chmod +x MyApp.app/Contents/Resources/foo” to make it runnable.

    You can also use the distutils package_data, data_files, and/or MANIFEST stuff to add arbitrary files with arbitrary relative paths, which might be a better solution, but it’s more complicated.

    Either way, in your script, you should use the bundle-related path, which you can easily access via PyObjC. Given that you’re using a PowerPC executable, you may need so much backward compatibility that you can’t rely on that, in which case you may have to make do with just “../Resources/foo”, but otherwise, it looks like this:

    import Foundation
    # ...
    bundle = Foundation.NSBundle.mainBundle()
    path = bundle.pathForResource_ofType_('foo', None)
    

    You can then launch it with NSTask, or subprocess,Popen, os.system, etc.

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

Sidebar

Related Questions

I've made this nice python app that runs when i use python main.py in
I have a nice clean domain layer in my app that was developed in
Python date calculations, where art thou? I have a python app that needs to
Languages like Python, MATLAB, E-Lisp have this nice facility for doc-strings. With this feature
I'm using emacs for python, and I'd like to have a nice useable shell
I have some really nice Python code to do what I need to do.
Python list comprehensions are nice, but near impossible to debug. You guys have any
I want to replace some headers by images, so I would have nice font.For
I have a nice dataset loop working, but I need to run another loop
I have an app that makes a HTTP GET request to a particular URL

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.