Search code examples
pythonmacosargument-passingexit-codepy2app

Passing shell command to a terminal application from an App in Mac


I have frozen a python based GUI script using Py2app successfully but I run into trouble using this app on Mac. This app is supposed to send arguments/parameters to Clustal, a terminal-based application, but it instead returns an error non-zero exit status 127, '/bin/sh: clustal: command not found'.

I found that my frozen app can send shell command successfully when I execute the same app from Frozen_apl.app>Contents>MacOS>Frozen_apl (which is a UNIX executable file).

Why do these shell commands get blocked when they are passed directly from app? How can I get around this problem?

Note: Clustal is properly installed and its path is properly set. I use OS X 10.9. I have same script frozen for Ubuntu and Windows and they work just fine.


Solution

  • Quoting from Py2app 0.6.4 minor feature release:

    Issue #15: py2app now has an option to emulate the shell environment you get by opening a window in the Terminal.

    Usage: python setup.py py2app --emulate-shell-environment

    This option is experimental, it is far from certain that the implementation works on all systems.

    Using this option with Py2app solved the problem of blocked communication between Py2app-frozen app and Os X shell.