Re: pexpect ssh login and ls | grep

2008-01-01 Thread crybaby
I did try to excute the ssh and shell ls grep command in all in one like so: ssh [EMAIL PROTECTED] "ls mytest.log > /dev/null 2>&1; echo $?" This seem to work, but also throwing exceptions. Also, including ssh and shell command together would be a problem when I later add a pass phrase to ssh k

Re: pexpect ssh login and ls | grep

2008-01-01 Thread crybaby
I don't get 0 or 2(excuting ls command exit code) from result.split('\r\n')[0] or result.split('\r\n')[1]. I have to try another method. Regular shell ssh login: [EMAIL PROTECTED] ~]$ ssh [EMAIL PROTECTED] Last login: Mon Dec 31 20:51:09 2007 from com1 [EMAIL PROTECTED] ~]$ Pexpect Login: >>> i

Re: pexpect ssh login and ls | grep

2007-12-31 Thread crybaby
1) what are these characters: \x1b]0; ~\x07\x1b[?1034h in line '\x1b]0;[EMAIL PROTECTED]:[EMAIL PROTECTED] ~]'? 2) Also, how come I don't get 0 or 2(excuting ls command exit code) from result.split('\r\n')[0] or result.split('\r\n')[1] ? This is what I get: >>> import pexpect >>> child=pexpect.s

pexpect ssh login and ls | grep

2007-12-31 Thread crybaby
I need to ssh into a remote machine and check if mytest.log file is there. I have setup ssh keys to handle login authentications. How do I determine if mytest.log is there by using Pexpect. What I have done so far is spawned a child for ssh. 1) Now what do I do to execute shell_cmd(ls and grep),

Eclipse3.3 with Pydev 1.3.10 Mylar problem, have Mylyn

2007-11-05 Thread crybaby
Right now I am trying to install pydev 1.3.10 on Eclipse 3.3. I am getting an Mylar error org.eclipse.mylar (2.0.0.v20070403-1300) or something needed. Mylyn is mylar, now. How do you disable the mylar dependency, so that Mylyn is used by PyDev? -- http://mail.python.org/mailman/listinfo/python-

ValueError: invalid \x escape

2007-11-01 Thread crybaby
I wrote a python code in linux text pad and copied to thumb drive and try to ran the file by changing the path to windows: sys.path = sys.path + ['D:\Python24\Lib\site-packages\mycode] I get the following error: ValueError: invalid \x escape I am pretty sure this problem is due some kind of lin

newb: Question regarding custom exception

2007-09-23 Thread crybaby
Why you specify type and name of the exception in your custom exceptions, but not in built in exceptions except IOError: print "no file by the name ccy_rates*.txt" except MyError, e: print e.msg Also, when you do: try: raise MyError(23) In "try: MyError(23) ", y

newb: glob on windows os.renames creates many nested folders

2007-09-22 Thread crybaby
when I do this in my python code and run it in windows xp, it creates ctemp//.../.../../ so on and creates file t. Not file starting with the name complist and ending with .txt (complist*.txt). Any idea why this may be? glob only works in *nix not on windows? os.renames(glob.glob('complist*.

newb: Simple regex problem headache

2007-09-21 Thread crybaby
import re s1 =' 25000 ' s2 = ' 5.5910 ' mypat = re.compile('[0-9]*(\.[0-9]*|$)') rate= mypat.search(s1) print rate.group() rate=mypat.search(s2) print rate.group() rate = mypat.search(s1) price = float(rate.group()) print price I get an error when it hits the whole number, that is in this forma

Re: newb: BeautifulSoup

2007-09-21 Thread crybaby
print all_tds[0].string print all_tds[8].string On Sep 21, 3:38 am, 7stud <[EMAIL PROTECTED]> wrote: > On Sep 20, 9:04 pm, crybaby <[EMAIL PROTECTED]> wrote: > > > I need to traverse a html page with big table that has many row and > > columns. For example, how to go

newb: BeautifulSoup

2007-09-20 Thread crybaby
I need to traverse a html page with big table that has many row and columns. For example, how to go 35th td tag and do regex to retireve the content. After that is done, you move down to 15th td tag from 35th tag (35+15) and do regex to retrieve the content? -- http://mail.python.org/mailman/li

Re: Python Regex Question

2007-09-20 Thread crybaby
On Sep 20, 4:12 pm, Tobiah <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I need to extract the number on each > > i.e 49.950 from the following: > > >  49.950  > > > The actual number between:  49.950  can be any number of > > digits before decimal and after decimal. > > >  ##.