Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problems with popen (linux7.3 python2.2.2)

1 view
Skip to first unread message

Byrom, R (Rob)

unread,
Nov 26, 2003, 8:15:29 AM11/26/03
to pytho...@python.org
hi,
When I use:
os.popen('ssh -l root@something tomcat4 stop')
I find the command always hangs. The 'something' host contains the correct
key in the authorized_hosts file and works ok on the command prompt. I've
tried os.system() but this also hangs. I notice that the 'tomcat4 stop' is
being executed but when I do a 'ps -ef' I notice the popen process is still
alive. I've also noticed this command sometimes works (ie it doesnt hang)
but I've no idea why. Has anyone experienced similar problems with this? Or
does anyone have any alternative suggestions? I'm really at my wits end with
this one!
thanks alot,
Rob


Byrom, R (Rob)

unread,
Nov 26, 2003, 8:48:27 AM11/26/03
to pytho...@python.org
I think I've found the problem.

When I run the python script I run it as a background process, this seems to
cause any popen() calls to hang indefinately (where each call remotely
executes a command via ssh). I'm not sure why this is the case though so I
was hoping someone could help explain!

thanks,
rob


--
http://mail.python.org/mailman/listinfo/python-list

Michael T. Babcock

unread,
Nov 26, 2003, 10:49:55 AM11/26/03
to pytho...@python.org
>
>
>When I use:
>os.popen('ssh -l root@something tomcat4 stop')
>I find the command always hangs.
>

Try adding a "-t" to your SSH command-line; it forces it to request a
TTY instead of being silent. SSH tries to do "the right thing" when not
launched from a terminal prompt.

--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock

Byrom, R (Rob)

unread,
Nov 26, 2003, 11:34:51 AM11/26/03
to pytho...@python.org
thanks! I'll give this a try. I did managed to avoid the 'hang' by putting
the python script in the foreground (previously I was running the script as
a back ground process).

--
http://mail.python.org/mailman/listinfo/python-list

0 new messages