[Tutor] why "ifconfig" is alway running?

2010-12-18 Thread lei yang
my script is #!/usr/bin/env python import datetime import subprocess import sys import os import signal from time import sleep def runForAWhile(cmd, secs=10): print("running %s" % cmd) timeout = datetime.timedelta(seconds=secs) print timeout proc = subprocess.Popen(cmd, stdout=subprocess.

Re: [Tutor] why "ifconfig" is alway running?

2010-12-18 Thread lei yang
ing 128.224.165.20 -c 4" runForAWhile(cmd,30) I see that "status" always "!=0“ why program is NOT exited Lei On Sun, Dec 19, 2010 at 1:15 AM, Alan Gauld wrote: > > "lei yang" wrote > >> def runForAWhile(cmd, secs=10): >>   proc = subp

Re: [Tutor] why "ifconfig" is alway running?

2010-12-19 Thread lei yang
On Sun, Dec 19, 2010 at 4:57 PM, Alan Gauld wrote: > > "lei yang" wrote > > > def runForAWhile(cmd, secs=10): >   print("running %s" % cmd) >   timeout = datetime.timedelta(seconds=secs) >   print timeout >   proc = subprocess.Popen(cmd, stdout=sub

Re: [Tutor] why "ifconfig" is alway running?

2010-12-19 Thread lei yang
..@10.0.0.1" host_run(cmd,10) if cmd="ssh r...@10.0.0.1" it never print "hello i'm here" , how can i handle this issue, and I find my script cant process the "timeout" to kill it. if cmd="ping 128.114.122.2", no this issue. Lei On Sun, Dec 19, 2010

Re: [Tutor] why "ifconfig" is alway running?

2010-12-19 Thread lei yang
t. I don't know why. my script is to run a cmd, if more than 10 sec, kill it can you show me where is wrong, thanks in advance Lei > So my guess is, your script gets stuck at that line. > But if you ctrl-C to stop the script, you should see where your program gets > stuck. You di

Re: [Tutor] why "ifconfig" is alway running?

2010-12-19 Thread lei yang
tuck. That would be a very > important first step for debugging. > > And if I run this script, I get the following: > " > $> python bla.py > running ssh r...@10.0.0.1 > ssh: connect to host 10.0.0.1 port 22: Connection refused > > hello,i'm here &

Re: [Tutor] why "ifconfig" is alway running?

2010-12-19 Thread lei yang
sh r...@10.0.0.1 >>> for you? >>> >> >> [lya...@pek-lpgbuild13 py]$ ssh r...@10.0.0.1 >> ssh: connect to host 10.0.0.1 port 22: Connection timed out >> >> but it will wait for above 30 seconds then print "ssh: connect to host >> 10.0.0.1

Re: [Tutor] why "ifconfig" is alway running?

2010-12-19 Thread lei yang
On Sun, Dec 19, 2010 at 9:05 PM, Sander Sweers wrote: > On 19 December 2010 13:43, lei yang wrote: >> Right, it gets stuck at the readline(), is there a function not get >> stuck to instead of readline(). > > readline() will keep reading stdout until it received a newli

Re: [Tutor] why "ifconfig" is alway running?

2010-12-20 Thread lei yang
On Sun, Dec 19, 2010 at 9:05 PM, Sander Sweers wrote: > On 19 December 2010 13:43, lei yang wrote: >> Right, it gets stuck at the readline(), is there a function not get >> stuck to instead of readline(). > > readline() will keep reading stdout until it received a newli

[Tutor] what's wrong with this ?

2015-04-21 Thread lei yang
>>>start_time = "2014-7-1" >>> revlines = commands.getoutput("git log --pretty=format:'%ad:%an' --date=short --since='%s' --no-merges" %start_time).strip().split('\n') Traceback (most recent call last): File "", line 1, in ValueError: unsupported format character 'a' (0x61) at index 26 >>> if

[Tutor] help about to how many times the function called

2013-01-04 Thread lei yang
Hi experts I have a function will print PASS status def print_pass(t_elapsed): """ Print PASS to stdout with PASS (green) color. """ print_stdout(bcolors.PASS + "PASS" + bcolors.ENDC + " (%.2f s)" % t_elapsed) I want to calculate the pass number, so I want to get " how many tim

[Tutor] how to send "ctrl+a+c" with python

2014-01-22 Thread lei yang
Hi expert, I want to use pexpect to send "ctrl+a+c" how should I do? self.vm_session.sendline("") how to fill ??? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinf

Re: [Tutor] how to send "ctrl+a+c" with python

2014-01-22 Thread lei yang
thanks, it works for me Lei On Wed, Jan 22, 2014 at 10:35 PM, eryksun wrote: > On Wed, Jan 22, 2014 at 8:49 AM, lei yang wrote: > > > > I want to use pexpect to send "ctrl+a+c" > > What's ctrl+a+c? If this is for screen, then I think you mean ctrl+a c: &g

[Tutor] how to express shift+enter in python

2014-09-28 Thread lei yang
Hi expert, How to express shift+enter in python ? Thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to express shift+enter in python

2014-09-28 Thread lei yang
Hi Chris, I just use "xlwt" lib to newline in one cell, I find it display with one line in windows but works in linux, so I guess it maybe"shift+enter" to newline Lei On Sun, Sep 28, 2014 at 11:04 PM, Chris “Kwpolska” Warrick < kwpol...@gmail.com> wrote: > On Sun,