wx.Execute(ssh ping) jams gui

.Execute(ping localhost)
.Execute(ping localhost)
I have code that polls for stdout, appends it to a wx.TextCtrl,
somehow the display is updated, good.

.Execute(ping localhost)
.Execute(ssh localhost ping -c 5 localhost)
prints show me the stdout is getting appended to TextCtrl, but the
display does not update.
That alone is the problem.

Extra points that might help understand it:

grabbing the corner of the window and dragging to resize:
the window resizes, but nothing inside refreshes. If I expand it, I
get grey where the controls should expand into.

there are buttons I can click that resize the TextCtrl - the TextCtrl
does not resize, but it does refresh and I see the ping output.
once the ping stops (like when -c5 runs out) then everything returns to normal.

clicking the buttons does show the visible focus getting set. hitting
tab does not, but when the ping ends then the expected button has
focus. (I can't really say when it actually got focus, I can only
report on where I see the red outline. )

I have tried a bunch of ssh options, none of these helped: "ssh -a -k
-T -x localhost ping...."

I am using ping as a simple example. the ssh part is real though - I
run a command on a remote box, need to see it's stdout. I have ssh
keys setup so there isn't any login.

(veyepar)juser@pc9e:~$ ssh localhost ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms

"ssh localhost ping localhost" is somehow different than "ping
localhost" and it is causing the wx event loop to get stuck or
something. i get no "64 bytes from localhos...t" like I do with the
non ssh. if I kill the ping, then all of the output shows up.

here is the app:
https://github.com/CarlFK/dvsmon/blob/master/dvs-mon.py

Run it, hit the "Run" and "Detail" buttons.

···

--
Carl K

I think the problem may be that ssh is not exiting at the end of the
command - sorry don't have my references to hand for ssh and it is a
while since I used it. wxExecute will not usually update the display
until the executed program has finished. You could try some of the
items in python subprocess module.

Gadget/Steve

···

On 30/11/2011 2:43 AM, Carl Karsten wrote:

.Execute(ping localhost)
.Execute(ping localhost)
I have code that polls for stdout, appends it to a wx.TextCtrl,
somehow the display is updated, good.

.Execute(ping localhost)
.Execute(ssh localhost ping -c 5 localhost)
prints show me the stdout is getting appended to TextCtrl, but the
display does not update.
That alone is the problem.

Extra points that might help understand it:

grabbing the corner of the window and dragging to resize:
the window resizes, but nothing inside refreshes. If I expand it, I
get grey where the controls should expand into.

there are buttons I can click that resize the TextCtrl - the TextCtrl
does not resize, but it does refresh and I see the ping output.
once the ping stops (like when -c5 runs out) then everything returns to normal.

clicking the buttons does show the visible focus getting set. hitting
tab does not, but when the ping ends then the expected button has
focus. (I can't really say when it actually got focus, I can only
report on where I see the red outline. )

I have tried a bunch of ssh options, none of these helped: "ssh -a -k
-T -x localhost ping...."

I am using ping as a simple example. the ssh part is real though - I
run a command on a remote box, need to see it's stdout. I have ssh
keys setup so there isn't any login.

(veyepar)juser@pc9e:~$ ssh localhost ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms

"ssh localhost ping localhost" is somehow different than "ping
localhost" and it is causing the wx event loop to get stuck or
something. i get no "64 bytes from localhos...t" like I do with the
non ssh. if I kill the ping, then all of the output shows up.

here is the app:
dvsmon/dvs-mon.py at master · CarlFK/dvsmon · GitHub

Run it, hit the "Run" and "Detail" buttons.

Um, the problem ocures while ssh is running, so unless the exit
problem is going back in time... :slight_smile:

The point of this app is to monitor programs that run for hours.

The local ping commands run forever and do not have a problem.

Here is what takes care of getting the output and displaying it:

        stdout = wx.TextCtrl(
                panel_cr, style=wx.TE_READONLY|wx.TE_MULTILINE)
        stderr = wx.TextCtrl(
                panel_cr, style=wx.TE_READONLY|wx.TE_MULTILINE)

        # start a timer to check for stdout/err
        panel_cr.Bind(wx.EVT_TIMER, self.OnTimer)
        self.timer = wx.Timer( panel_cr)
        self.timer.Start(100)

    def ShowIO(self):
        if self.process is not None:

            def one(stream,ctrl):
              while stream.CanRead():
                line = stream.read()
                line = line.strip()
                self.AppendLine(ctrl,line)

            one(self.process.GetInputStream(), self.stdout)
            one(self.process.GetErrorStream(), self.stderr)

    def OnTimer(self,event):
        self.ShowIO()

Which now that I think about it isn't relevant to the ssh exit thing,
but I guess it can't hurt to highlight it. and to be clear, this
code is working fine in all cases: the ping responses hit
stream.read() as expected: printing them to the terminal shows them
pinging away.

I think the lack of window refresh/redraw on resize may be the easiest
to understand.

···

On Wed, Nov 30, 2011 at 12:16 AM, Gadget/Steve <GadgetSteve@live.co.uk> wrote:

On 30/11/2011 2:43 AM, Carl Karsten wrote:

.Execute(ping localhost)
.Execute(ping localhost)
I have code that polls for stdout, appends it to a wx.TextCtrl,
somehow the display is updated, good.

.Execute(ping localhost)
.Execute(ssh localhost ping -c 5 localhost)
prints show me the stdout is getting appended to TextCtrl, but the
display does not update.
That alone is the problem.

Extra points that might help understand it:

grabbing the corner of the window and dragging to resize:
the window resizes, but nothing inside refreshes. If I expand it, I
get grey where the controls should expand into.

there are buttons I can click that resize the TextCtrl - the TextCtrl
does not resize, but it does refresh and I see the ping output.
once the ping stops (like when -c5 runs out) then everything returns to normal.

clicking the buttons does show the visible focus getting set. hitting
tab does not, but when the ping ends then the expected button has
focus. (I can't really say when it actually got focus, I can only
report on where I see the red outline. )

I have tried a bunch of ssh options, none of these helped: "ssh -a -k
-T -x localhost ping...."

I am using ping as a simple example. the ssh part is real though - I
run a command on a remote box, need to see it's stdout. I have ssh
keys setup so there isn't any login.

(veyepar)juser@pc9e:~$ ssh localhost ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms

"ssh localhost ping localhost" is somehow different than "ping
localhost" and it is causing the wx event loop to get stuck or
something. i get no "64 bytes from localhos...t" like I do with the
non ssh. if I kill the ping, then all of the output shows up.

here is the app:
dvsmon/dvs-mon.py at master · CarlFK/dvsmon · GitHub

Run it, hit the "Run" and "Detail" buttons.

I think the problem may be that ssh is not exiting at the end of the
command - sorry don't have my references to hand for ssh and it is a
while since I used it. wxExecute will not usually update the display
until the executed program has finished. You could try some of the
items in python subprocess module.

--
Carl K

What platform and wx version? If on Windows then which ssh are you using?

···

On 11/29/11 6:43 PM, Carl Karsten wrote:

clicking the buttons does show the visible focus getting set. hitting
tab does not, but when the ping ends then the expected button has
focus. (I can't really say when it actually got focus, I can only
report on where I see the red outline. )

I have tried a bunch of ssh options, none of these helped: "ssh -a -k
-T -x localhost ping...."

I am using ping as a simple example. the ssh part is real though - I
run a command on a remote box, need to see it's stdout. I have ssh
keys setup so there isn't any login.

(veyepar)juser@pc9e:~$ ssh localhost ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms

"ssh localhost ping localhost" is somehow different than "ping
localhost" and it is causing the wx event loop to get stuck or
something. i get no "64 bytes from localhos...t" like I do with the
non ssh. if I kill the ping, then all of the output shows up.

here is the app:
dvsmon/dvs-mon.py at master · CarlFK/dvsmon · GitHub

Run it, hit the "Run" and "Detail" buttons.

--
Robin Dunn
Software Craftsman

ubuntu, oneiric, both wx in the repo (2.8.11) and the most current I
could find in apt.wxwidgets.org:

(veyepar)root@pc9e:~/temp# apt-cache policy python-wxgtk2.8
python-wxgtk2.8:
  Installed: 2.8.12.0-0
  Candidate: 2.8.12.0-0
  Version table:
*** 2.8.12.0-0 0
        500 http://apt.wxwidgets.org/ natty-wx/main amd64 Packages
        100 /var/lib/dpkg/status
     2.8.11.0-0ubuntu10 0
        500 Index of /ubuntu oneiric/universe amd64 Packages

···

On Wed, Nov 30, 2011 at 12:33 PM, Robin Dunn <robin@alldunn.com> wrote:

On 11/29/11 6:43 PM, Carl Karsten wrote:

clicking the buttons does show the visible focus getting set. hitting
tab does not, but when the ping ends then the expected button has
focus. (I can't really say when it actually got focus, I can only
report on where I see the red outline. )

I have tried a bunch of ssh options, none of these helped: "ssh -a -k
-T -x localhost ping...."

I am using ping as a simple example. the ssh part is real though - I
run a command on a remote box, need to see it's stdout. I have ssh
keys setup so there isn't any login.

(veyepar)juser@pc9e:~$ ssh localhost ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms

"ssh localhost ping localhost" is somehow different than "ping
localhost" and it is causing the wx event loop to get stuck or
something. i get no "64 bytes from localhos...t" like I do with the
non ssh. if I kill the ping, then all of the output shows up.

here is the app:
dvsmon/dvs-mon.py at master · CarlFK/dvsmon · GitHub

Run it, hit the "Run" and "Detail" buttons.

What platform and wx version? If on Windows then which ssh are you using?

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
Carl K

Bump.

The behaviour has been confirmed on at least 1 other person's install.

···

On Wed, Nov 30, 2011 at 3:49 PM, Carl Karsten <carl@personnelware.com> wrote:

ubuntu, oneiric, both wx in the repo (2.8.11) and the most current I
could find in apt.wxwidgets.org:

(veyepar)root@pc9e:~/temp# apt-cache policy python-wxgtk2.8
python-wxgtk2.8:
Installed: 2.8.12.0-0
Candidate: 2.8.12.0-0
Version table:
*** 2.8.12.0-0 0
500 http://apt.wxwidgets.org/ natty-wx/main amd64 Packages
100 /var/lib/dpkg/status
2.8.11.0-0ubuntu10 0
500 Index of /ubuntu oneiric/universe amd64 Packages

On Wed, Nov 30, 2011 at 12:33 PM, Robin Dunn <robin@alldunn.com> wrote:

On 11/29/11 6:43 PM, Carl Karsten wrote:

clicking the buttons does show the visible focus getting set. hitting
tab does not, but when the ping ends then the expected button has
focus. (I can't really say when it actually got focus, I can only
report on where I see the red outline. )

I have tried a bunch of ssh options, none of these helped: "ssh -a -k
-T -x localhost ping...."

I am using ping as a simple example. the ssh part is real though - I
run a command on a remote box, need to see it's stdout. I have ssh
keys setup so there isn't any login.

(veyepar)juser@pc9e:~$ ssh localhost ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.051 ms

"ssh localhost ping localhost" is somehow different than "ping
localhost" and it is causing the wx event loop to get stuck or
something. i get no "64 bytes from localhos...t" like I do with the
non ssh. if I kill the ping, then all of the output shows up.

here is the app:
dvsmon/dvs-mon.py at master · CarlFK/dvsmon · GitHub

Run it, hit the "Run" and "Detail" buttons.

What platform and wx version? If on Windows then which ssh are you using?

--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
Carl K

--
Carl K

It's working fine here on Ubuntu 10.10. I suspect it has more to do with the platform/environment/ssh version than it does with wx. Have you checked if the subprocess module has the same issue?

···

On 12/5/11 6:06 AM, Carl Karsten wrote:

Bump.

The behaviour has been confirmed on at least 1 other person's install.

On Wed, Nov 30, 2011 at 3:49 PM, Carl Karsten<carl@personnelware.com> wrote:

ubuntu, oneiric, both wx in the repo (2.8.11) and the most current I
could find in apt.wxwidgets.org:

(veyepar)root@pc9e:~/temp# apt-cache policy python-wxgtk2.8
python-wxgtk2.8:
  Installed: 2.8.12.0-0
  Candidate: 2.8.12.0-0
  Version table:
  *** 2.8.12.0-0 0
        500 http://apt.wxwidgets.org/ natty-wx/main amd64 Packages
        100 /var/lib/dpkg/status
     2.8.11.0-0ubuntu10 0
        500 Index of /ubuntu oneiric/universe amd64 Packages

--
Robin Dunn
Software Craftsman

Bump.

The behaviour has been confirmed on at least 1 other person's install.

ubuntu, oneiric, both wx in the repo (2.8.11) and the most current I
could find in apt.wxwidgets.org:

(veyepar)root@pc9e:~/temp# apt-cache policy python-wxgtk2.8
python-wxgtk2.8:
Installed: 2.8.12.0-0
Candidate: 2.8.12.0-0
Version table:
*** 2.8.12.0-0 0
500 http://apt.wxwidgets.org/ natty-wx/main amd64 Packages
100 /var/lib/dpkg/status
2.8.11.0-0ubuntu10 0
500 Index of /ubuntu oneiric/universe amd64
Packages

It's working fine here on Ubuntu 10.10.

just installed and tested:
yep, works fine on 10.10.
problem exists on 11.04, 11.11 and the current daily beta.

I suspect it has more to do with
the platform/environment/ssh version than it does with wx.

I just want to run shell commands, which uses my app, which uses
wxPython, which uses wx, and so on down the rabbit hole. wee.

I'll bug the ubuntu-desktop group and see if they have any ideas.

Have you checked
if the subprocess module has the same issue?

not yet. Currently I can open a terminal, ssh to the box, run the
command and get back to work. So it isn't a high priority.

Other than get my app working, is there anything to be gained? I'll
bump up it's priority if it will help the wx/Python project. I might
even do it just to satisfy your curiosity - you seem to have eared
some .. um... karma or whatever :slight_smile:

···

On Mon, Dec 5, 2011 at 3:13 PM, Robin Dunn <robin@alldunn.com> wrote:

On 12/5/11 6:06 AM, Carl Karsten wrote:

On Wed, Nov 30, 2011 at 3:49 PM, Carl Karsten<carl@personnelware.com> >> wrote:

--
Carl K

No, I was just thinking that maybe it would be a good alternative for you. It's possible that the subprocess module does something a little differently that doesn't jam things up with ssh.

···

On 12/7/11 1:01 AM, Carl Karsten wrote:

On Mon, Dec 5, 2011 at 3:13 PM, Robin Dunn<robin@alldunn.com> wrote:

Have you checked
if the subprocess module has the same issue?

not yet. Currently I can open a terminal, ssh to the box, run the
command and get back to work. So it isn't a high priority.

Other than get my app working, is there anything to be gained? I'll
bump up it's priority if it will help the wx/Python project. I might
even do it just to satisfy your curiosity - you seem to have eared
some .. um... karma or whatever :slight_smile:

--
Robin Dunn
Software Craftsman

quick test suggests it does not jam things up:

@@ -143,10 +145,9 @@ class CommandRunner(object):
         if self.process is None:
             self.MarkOuts("Starting...")
             self.txt_cmd.SetForegroundColour(wx.GREEN)

- self.process = wx.Process(self.panel_cr)
- self.process.Redirect()
- self.pid = wx.Execute(
- self.cmd, wx.EXEC_ASYNC, self.process)

+ cmd = self.cmd.split()
+ p=subprocess.Popen(cmd,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)

             self.MarkOuts("Started.")
             print 'Executed: %s' % (self.cmd)

Without stdou/errt=subprocess.PIPE the output goes to the console as expected.

That went easier than expected - lets hope poling for output is just as easy.

I would still like to submit a bug report somewhere. I'll do it
generically against ubuntu, and poke some of the bug team about
properly classifying it.

Any suggestions on other shell commands I can try that might behave
similar to ssh? "ssh localhost ping localhost" is not a great
example, mainly because it requires setting up ssh keys. I was
hoping "cat" would work, given it reads from stdin and writes to
stdout, but it did not jam the gui.

···

On Wed, Dec 7, 2011 at 1:09 PM, Robin Dunn <robin@alldunn.com> wrote:

On 12/7/11 1:01 AM, Carl Karsten wrote:

On Mon, Dec 5, 2011 at 3:13 PM, Robin Dunn<robin@alldunn.com> wrote:

Have you checked
if the subprocess module has the same issue?

not yet. Currently I can open a terminal, ssh to the box, run the
command and get back to work. So it isn't a high priority.

Other than get my app working, is there anything to be gained? I'll
bump up it's priority if it will help the wx/Python project. I might
even do it just to satisfy your curiosity - you seem to have eared
some .. um... karma or whatever :slight_smile:

No, I was just thinking that maybe it would be a good alternative for you.
It's possible that the subprocess module does something a little
differently that doesn't jam things up with ssh.

--
Carl K