Reputation: 4089
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.
Upvotes: 0
Views: 944
Reputation: 4089
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.
Upvotes: 1
Reputation: 125758
[Based on the discussion in comments] This isn't a problem with the arguments, it's due to the spawned shell not being able to find the clustal
executable. I'm not sure why this is, since it's in /usr/local/bin/clustal, and since /usr/local/bin is in OS X's default PATH (it's listed in /etc/paths). Using the full path to the executable worked, so it appears the frozen app is spawning a shell with a non-default PATH.
Including the full path (/usr/local/bin/clustal) in the frozen app isn't really an optimal solution; it'd be better to figure out how to get a normal PATH in the spawned shell. But I'm now familiar enough with Py2app to know how to do this. (JeeYem: please give the workaround you came up with in a comment or another answer.)
Upvotes: 1