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:

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 21; 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 key.

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

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

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

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

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) , you

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?

Re: newb: BeautifulSoup

2007-09-21 Thread crybaby
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 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

newb: Simple regex problem headache

2007-09-21 Thread crybaby
import re s1 ='nbsp;25000nbsp;' s2 = 'nbsp;5.5910nbsp;' 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

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 td tags from a html file. i.e 49.950 from the following: td align=right width=80font size=2 face=New Times Roman,Times,Serifnbsp;49.950nbsp;/font/td The actual number

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