Most likely, the Python system ( /usr/bin/python ) is launched to execute your script, and not MacPorts Python ( /opt/local/bin/python2.6 ), where you installed appscript . What should work (unchecked!) Is to insert the Python MacPorts path as the first Program Argument , before the script path. And in this case you do not need to specify PYTHONPATH . Theoretically, you could do what you have while MacPorts Python is configured compatible (i.e., similar arches, deployment targets, etc.) with the Python system, but you probably shouldn't or shouldn't go around this way.
Another approach would be to change the shebang line (first line) of the script to the explication path on MacPorts Python:
#!/opt/local/bin/python2.6
The reason this works in the command line shell is likely that one of the shell profile files, for example .bash_profile , changes the PATH environment variable to first include the MacPorts Python path ( /opt/local/bin ) to /usr/bin/env python first finds MacPython python . When passing through launchd shell is not involved, so the PATH manipulation is not performed; the default search is done by default, i.e. /usr/bin/env python does /usr/bin/python .
source share