I have a python script that sets a couple environment vars and runs a shell script in a Terminal window. It works when run from a Terminal with 'python doshell.py'. But when packaged into an app with py2app I get errors.
Here's a simplified version (doshell.py): #!/usr/bin/env python import sys import os base = os.path.dirname(sys.argv[0]) # options used by myshell.sh (can't use args) os.environ['STARTBASE'] = base os.environ['MYOPTION'] = 'shelloption' shellrun = base + '/myshell.sh' os.execlp('open', 'open', '-a', 'Terminal.app', shellrun) # continue doing python stuff... The error I get: Traceback (most recent call last): File "/Users/Shared/src/myshell/dist/doshell.app/Contents/ Resources/__boot__.py", line 137, in ? _run('doshell.py') File "/Users/Shared/src/myshell/dist/doshell.app/Contents/ Resources/__boot__.py", line 134, in _run execfile(path, globals(), globals()) File "/Users/Shared/src/myshell/dist/doshell.app/Contents/ Resources/doshell.py", line 18, in ? os.execlp('open', 'open', '-a', 'Terminal.app', shellrun) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/os.py", line 324, in execlp execvp(file, args) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/os.py", line 341, in execvp _execvpe(file, args) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/os.py", line 379, in _execvpe func(fullname, *argrest) OSError: [Errno 45] Operation not supported 2006-08-10 12:11:34.918 CommandDroplet[409] doshell Error 2006-08-10 12:11:34.919 CommandDroplet[409] doshell Error An unexpected error has occurred during execution of the main script I've built the app with the semi_standalone option, and the myshell.sh script is also installed in the app with the resources option in py2app. Built completely standalone, same error, except that the os.py lines have no path. I tried using spawnlp instead, but in the Terminal AND in the py2app application I get the error: RegisterProcess failed (error = -50) I'm just getting my feet wet with Python, so I wouldn't be surprised if I did something wrong here. Maybe there's a better way to run the shell script in a Terminal. Maybe something is wrong with argv[0] when run from the app so the path to run the shell script is wrong. The error isn't very helpful. ----- William Kyngesburye <[EMAIL PROTECTED]> http://www.kyngchaos.com/ All generalizations are dangerous, even this one. _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig