Problem: Terminal (OS X) window exits immediately on opening. & Solution.

Lou Pecora louis.pecora at
Mon Mar 16 22:40:24 CET 2009

Python wrote:
> On 16 mrt 2009, at 22:10, Lou Pecora wrote:
>>> why don't you just execute the script directly form the terminal?
>>> then you will be able to read all error messages...
>>> and you can delete all the files you want
>>> just my 2c
>>> Arno
>> Because the shell process in the Terminal window would exit right 
>> after it started even when I was just trying to open a new window 
>> (not even running a script), i.e. command-N in Terminal.  So I could 
>> not run anything from the Terminal.
>> -- 
> (please use reply-all so it also goes to the list :)  )
> i don't understand...
> if you open the terminal from /Applications/Utilities/Terminal
> it comes up with a window and you can execute any script from there
> without the window closing when the script exits, or not?

No, I could not execute anything when I opened a window.  A shell would 
start, then immediately exit leaving an error message and a logout.  The 
Terminal has an 'Executestring' property in the preferences (Property 
List) which it tries to execute before giving you a shell prompt.  If 
that string has a bad command or refers to a file that does not exist 
(my case), the shell exits (Logout).  The Terminal is incapacitated 
until you remove that bad 'Executestring' from the preferences.  
Terminal does not crash.  The window stays open, but the shell is logged 
out.  Open another window, same thing happens.

I got that problem while running Python scripts from an Editor.  But 
even trying to just open a window/shell caused a failure.  The strange 
thing was that the bad file was a .py file down in the /var directory 
which something (BBEdit? The Terminal? Python? The System? ??) put 
there.  Why?  I don't know.


Lou Pecora

Code 6362
Naval Research Lab
Washington, DC  20375, USA
Ph:  +202-767-6002
email:  louis.pecora at

More information about the Python-list mailing list