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

L

Lou Pecora

Since this happened with a Python script and some people here use OS X
and Terminal to run scripts I thought this might be helpful.

I recently ran into this problem using Terminal and found the solution.
I thought those who use the Terminal in OS X might be interested.

The problem appeared suddenly. Whenever I tried to open a new window in
Terminal I would get the message that Terminal tried to execute a
certain file (way down in the /var directory), but the file didn't
exist. And the process would Exit. Very frustrating since you can't
use the Terminal to help find the problem.

E.g error message:

/var/tmp/folders.501/Cleanup\ At\
Startup/drvrSDWB_2-258580497.358.py.command; exit
-bash: /var/tmp/folders.501/Cleanup At
Startup/drvrSDWB_2-258580497.358.py.command: No such file or directory

The Solution is to go into the preference file for the Terminal (located
in
/Users/your_account_name_here/Library/Preferences/com.apple.Terminal.plis
t) and open it with the Property List Editor (should open automatically
with a double click or you might have to install the Property List
Editor from the System CDs that came with your computer). Under the
heading Executionstring you will see the name of the file that the
Terminal is choking on. Double click the name and delete it. Save. and
quit the Property List Editor. The Terminal should work normally now.

More info. I got this problem while running Python scripts from BBEdit
(which automatically launches the scripts in a Terminal Window). Why it
happened is lost on me. I don't know if Python, BBEdit, or Terminal
munged the property list. At least I managed to track it down.

I hope this helps someone if you've had this problem.
 
P

Python

Since this happened with a Python script and some people here use OS X
and Terminal to run scripts I thought this might be helpful.

I recently ran into this problem using Terminal and found the
solution.
I thought those who use the Terminal in OS X might be interested.

The problem appeared suddenly. Whenever I tried to open a new
window in
Terminal I would get the message that Terminal tried to execute a
certain file (way down in the /var directory), but the file didn't
exist. And the process would Exit. Very frustrating since you can't
use the Terminal to help find the problem.

E.g error message:

/var/tmp/folders.501/Cleanup\ At\
Startup/drvrSDWB_2-258580497.358.py.command; exit
-bash: /var/tmp/folders.501/Cleanup At
Startup/drvrSDWB_2-258580497.358.py.command: No such file or directory

The Solution is to go into the preference file for the Terminal
(located
in
/Users/your_account_name_here/Library/Preferences/
com.apple.Terminal.plis
t) and open it with the Property List Editor (should open
automatically
with a double click or you might have to install the Property List
Editor from the System CDs that came with your computer). Under the
heading Executionstring you will see the name of the file that the
Terminal is choking on. Double click the name and delete it. Save.
and
quit the Property List Editor. The Terminal should work normally now.

More info. I got this problem while running Python scripts from
BBEdit
(which automatically launches the scripts in a Terminal Window). Why
it
happened is lost on me. I don't know if Python, BBEdit, or Terminal
munged the property list. At least I managed to track it down.

I hope this helps someone if you've had this problem.
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
 
P

Python

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?
 
L

Lou Pecora

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[/QUOTE]

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.

More info: There is an Executestring in the Terminal preferences that
is executed (I would guess as a shell command or script) when the shell
starts up (which happens whenever a new window is opened). If that is
bad in any way, the shell exists with an error message. There is no way
to run any shell in the Terminal at that point. The only option appears
to be to clean up the preferences. I don't know why the preferences got
a bad command while I was running Python scripts. Maybe nothing to do
with Python, maybe it does. Not sure.
 
L

Lou Pecora

Python said:
(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 No.
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.

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375, USA
Ph: +202-767-6002
email: (e-mail address removed)
 
P

Python

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.

More info: There is an Executestring in the Terminal preferences that
is executed (I would guess as a shell command or script) when the
shell
starts up (which happens whenever a new window is opened). If that is
bad in any way, the shell exists with an error message. There is no
way
to run any shell in the Terminal at that point. The only option
appears
to be to clean up the preferences. I don't know why the preferences
got
a bad command while I was running Python scripts. Maybe nothing to do
with Python, maybe it does. Not sure.
[/QUOTE]
oh i think it understand i now... it has nothing to do with python,
has it?
just with some garbage left by a python script that should have been
deleted at startup of OSX

501 is the default user ID in OSX
maybe it's a bash thing?
 
L

Lou Pecora

Python said:
oh i think it understand i now... it has nothing to do with python,
has it?
Well, I can't figure out which app/system is to "blame."
just with some garbage left by a python script that should have been
deleted at startup of OSX
The garbage was left in the Terminal's preferences (the Property List).
That's pretty specific. Why? I don't know. It just shouldn't have
been there, I think. It had nothing to do with the startup of OS X.
501 is the default user ID in OSX
maybe it's a bash thing?
That's interesting. Could be. At least I found the solution and since
it seemed to involve Python, I thought the OS X people on the list might
be interested. Thanks for the info.

--
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC 20375, USA
Ph: +202-767-6002
email: (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top