Is pexpect unmaintained now?

2009-11-16 Thread yuzhichang
Pexpect 2.4 is only available at Pypi. Both the homepage of pexpect(http://www.noah.org/wiki/Pexpect) and download page (http://sourceforge.net/projects/pexpect/files/) are outdated. The repository on Github (http://github.com/noahspurrier/pexpect/) has been removed. I ever contacted the author(n

Where to find pexpect

2009-10-13 Thread Antoon Pardon
I have been looking for pexpect. The links I find like http://pexpect.sourceforge.net all end up at http://www.noah.org/wiki/Pexpect which produces a 404 not found problem. Does someone know the current location? -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to find pexpect

2009-10-13 Thread Javier Collado
Hello, Google is your friend: http://sourceforge.net/projects/pexpect/ http://sourceforge.net/projects/pexpect/files/pexpect/Release%202.3/pexpect-2.3.tar.gz/download Best regards, Javier 2009/10/13 Antoon Pardon apar...@forel.vub.ac.be: I have been looking for pexpect. The links I find

Re: Where to find pexpect

2009-10-13 Thread Jean-Michel Pichavant
Antoon Pardon wrote: I have been looking for pexpect. The links I find like http://pexpect.sourceforge.net all end up at http://www.noah.org/wiki/Pexpect which produces a 404 not found problem. Does someone know the current location? maybe they removed the distribution so you may use

Re: PExpect on Windows System Using Cygwin

2009-09-25 Thread Dave Angel
Sean DiZazzo wrote: On Sep 24, 4:37 pm, Dave Angel da...@ieee.org wrote: snip Why not just use the subprocess module? It's built into the Windows distribution, and doesn't need cygwin. DaveA Can subprocess pass things like passwords to running processes like pexpect can

Re: PExpect on Windows System Using Cygwin

2009-09-25 Thread Kevin Holleran
things like passwords to running processes like pexpect can? ~Sean I don't know what pexpect is/was capable of, since it's not apparently part of the current Python distributions. I thought it had the ability to fork or spawn a child process, with pipes connected. Anyway, subprocess can

PExpect on Windows System Using Cygwin

2009-09-24 Thread Kevin Holleran
Hello, I downloaded and installed the pexpect module and wrote a script. All is well and good, but the script proved to be pretty useful and now I was asked to run it as a scheduled task up on a server to run periodically. I was intending on simply packaging it up with Py2Exe and moving

Re: PExpect on Windows System Using Cygwin

2009-09-24 Thread Dave Angel
Kevin Holleran wrote: Hello, I downloaded and installed the pexpect module and wrote a script. All is well and good, but the script proved to be pretty useful and now I was asked to run it as a scheduled task up on a server to run periodically. I was intending on simply packaging it up

Re: PExpect on Windows System Using Cygwin

2009-09-24 Thread Sean DiZazzo
On Sep 24, 4:37 pm, Dave Angel da...@ieee.org wrote: Kevin Holleran wrote: Hello, I downloaded and installed the pexpect module and wrote a script.  All is well and good, but the script proved to be pretty useful and now I was asked to run it as a scheduled task up on a server to run

Re: pexpect and unicode strings

2009-09-04 Thread Sean DiZazzo
On Sep 4, 7:11 pm, Mathew Oakes mathew.oa...@memechine.org wrote: Is there anything that can be done to make pexpect spawns send unicode lines? In this example they are just middot characters, but this process needs to be able to handle languages in other character sets. spokentext

pexpect and unicode strings

2009-09-04 Thread Mathew Oakes
Is there anything that can be done to make pexpect spawns send unicode lines? In this example they are just middot characters, but this process needs to be able to handle languages in other character sets. spokentext = u'Nation . Search the FOX Nation . czars \xb7 Health care \xb7 town

pexpect on QNX platform

2009-08-20 Thread Asha Gowda
Hi, I found that pexpect is available only for linux. But we need to port to QNX, Is pexpect is available? If yes, where can I find it. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

A little help with pexpect

2009-07-19 Thread Hussein B
Hey, I'm trying to execute a command over a remore server using pexpect + url = 'ssh internalserver' res = pexpect.spawn(url) print '1' res.expect('.*ssword:') print '2' res.sendline('mypasswd') print '3' res.sendline('ls -aslh') + What I want to do is to send

Re: A little help with pexpect

2009-07-19 Thread Piet van Oostrum
Hussein B hubaghd...@gmail.com (HB) wrote: HB Hey, HB I'm trying to execute a command over a remore server using pexpect HB + HB url = 'ssh internalserver' HB res = pexpect.spawn(url) HB print '1' HB res.expect('.*ssword:') HB print '2' HB res.sendline('mypasswd') HB print '3' HB

Re: A little help with pexpect

2009-07-19 Thread Piet van Oostrum
Piet van Oostrum p...@cs.uu.nl (PvO) wrote: [snip] PvO You can also consider using paramiko instead of pexpect. [snip] chan = t.open_session() chan.exec_command('cat') chan.send('abcdefghijklmn\n') In a real program it is better to use sendall here, as send may decide to send only part

problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread Phoe6
I have been trying to use pexpect and I am failing with pexpect.TIMEOUT for all my attempts. In order to troubleshoot, I decided to go with simplest possible one. Here is my ssh to localhost: [21:29:14 senthil]$ssh localhost -l senthil sent...@localhost's password: sent...@ubuntu:~$ And here

problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread R. David Murray
Phoe6 orsent...@gmail.com wrote: I have been trying to use pexpect and I am failing with pexpect.TIMEOUT for all my attempts. In order to troubleshoot, I decided to go with simplest possible one. [...] Can someone help me what I am doing wrong here? Why is not working for such a simple

Re: problems while using pexpect: pexcept.TIMEOUT always

2009-06-08 Thread Senthil Kumaran
On Jun 8, 10:19 pm, R. David Murray rdmur...@bitdance.com wrote: I would suggest using the 'setlog' method of child to get more debugging information from pexpect.  I've found that the best way to diagnose the source of a timeout. setlog method seems to be deprecated and 'not allowed' too

Control a process interactively (pexpect) and save data

2009-05-06 Thread Piotrek G.
Hi, I'm trying to use something like pexpect.interact() but I want to save all my inputs and save all outputs from the process (/bin/sh Linux). The main goal is to record all sequence of commands and responses in order to automatically generate pexpect script. My script is like below so far

Strange pexpect behaviour: just duplicates stdin

2009-03-30 Thread Nikolaus Rath
Hello, I have a strange problem with pexpect: $ cat test.py #!/usr/bin/python import pexpect child = pexpect.spawn(./test.pl) while True: try: line = raw_input() except EOFError: break child.sendline(line) print child.readline().rstrip(\r\n) child.close

Re: pexpect on solaris 10

2009-03-04 Thread Jorgen Grahn
On Tue, 3 Mar 2009 14:37:20 -0800 (PST), Chris Pella skipad...@gmail.com wrote: Has anybody had success getting pexpect to work well on solaris 10 (x86)? I am trying to do some test automation which involves controlling some other processes. Soon after I spawn the process I am trying

pexpect on solaris 10

2009-03-03 Thread Chris Pella
Has anybody had success getting pexpect to work well on solaris 10 (x86)? I am trying to do some test automation which involves controlling some other processes. Soon after I spawn the process I am trying to control a message comes up on stdout telling me that a tty has been closed

Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

2009-01-30 Thread Linuxguy123
I'm trying to build a small Python app in Eclipse under Fedora 10. I have the following code: import os import sys import pexpect child = pexpect.spawn('/bin/bash') child.interact() When I run it in Eclipse, I get: Traceback (most recent call last): File /home/xxx/workspace/FixPermissions

Re: Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

2009-01-30 Thread Gary Duzan
On Jan 30, 11:03 am, Linuxguy123 linuxguy...@gmail.com wrote: I'm trying to build a small Python app in Eclipse under Fedora 10. I have the following code: import os import sys import pexpect child = pexpect.spawn('/bin/bash') child.interact() When I run it in Eclipse, I get

Pexpect and telnet not communicating properly

2009-01-27 Thread David Anderson
am using the following code: #!/usr/bin/env python import pexpect import sys child = pexpect.spawn('telnet 192.168.1.254') fout = file('mylog.txt','w') child.logfile = fout child.expect('sername : ') child.sendline('Administrator') child.expect('assword : ') child.sendline('') child.expect

Re: Pexpect and telnet not communicating properly

2009-01-27 Thread George Trojan
I am using the following code: #!/usr/bin/env python import pexpect import sys child = pexpect.spawn('telnet 192.168.1.254') fout = file('mylog.txt','w') child.logfile = fout child.expect('sername : ') child.sendline('Administrator') child.expect('assword

Re: Pexpect and telnet not communicating properly

2009-01-27 Thread Mark Wooding
pexpect: I use it to send the router's logs to my server. The obvious difference between my script and yours is that instead of sendline, I used send and an explicit carriage return. kid.expect('Username :') kid.send('admin\r\n') I think this is a result of a similar problem, but I

pexpect and inconsistent exit values

2008-12-15 Thread Heikki Toivonen
I don't seem to be able to figure out how to get the exit values of commands executed with pexpect reliably. Here's first with regular shell: hei...@ubuntu:~$ true; echo $? 0 Let's try with pexpect. Below is the program: ---CLIP--- import sys, pexpect cmd = true print 'cmd=', cmd child

pexpect and inconsistent exit codes

2008-12-11 Thread Heikki Toivonen
I don't seem to be able to figure out how to get the exit values of commands executed with pexpect reliably. Here's first with regular shell: [EMAIL PROTECTED]:~$ true; echo $? 0 Let's try with pexpect. Below is the program: ---CLIP--- import sys, pexpect cmd = true print 'cmd=', cmd child

Re: Output of pexpect

2008-10-01 Thread Lie Ryan
On Tue, 30 Sep 2008 20:48:12 -0700, Anh Khuong wrote: I am using pexpect and I want to send output of pexpet to both stdout and log file concurrently. Anybody know a solution for it please let me know. One way is to create a file-like object that forked the output to stdout and the logfile

Output of pexpect

2008-09-30 Thread Anh Khuong
Hi all, I am using pexpect and I want to send output of pexpet to both stdout and log file concurrently. Anybody know a solution for it please let me know. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Output of pexpect

2008-09-30 Thread Karthik Gurusamy
On Sep 30, 8:48 pm, Anh Khuong [EMAIL PROTECTED] wrote: Hi all, I am using pexpect and I want to send output of pexpet to both stdout and log file concurrently. Anybody know a solution for it please let me know. spawn class takes a 'logfile' parameter: __init__(self, command, args

Re: Pexpect echoes twice for each read

2008-09-19 Thread RDarrelBonner
On Sep 9, 4:01 pm, Sriram Rajan [EMAIL PROTECTED] wrote: For some reason, Using pexpect causes my output to echo twice when I connect from my MAC Darwin (10.4) to Linux (CentOS release 5 ): The program: - #!/usr/bin/python # Automatic scp to remote host # Input 1

Re: SSH using PEXPECT

2008-09-18 Thread Almar Klein
Hi, Wanting to use pexpect on windows too, I ran into wexpect. http://sage.math.washington.edu/home/goreckc/sage/wexpect/ I haven't given it a try yet. Does anyone have experience with that? Almar 2008/9/13 nntpman68 [EMAIL PROTECTED] Hi, [EMAIL PROTECTED] wrote: On Sep 10, 7:01 pm, Sean

Re: SSH using PEXPECT

2008-09-13 Thread nntpman68
Hi, [EMAIL PROTECTED] wrote: On Sep 10, 7:01 pm, Sean DiZazzo [EMAIL PROTECTED] wrote: I am using windows and for reason it wont let me use pexpect even tho I have CYGWIN installed I get the following error Traceback (most recent call last): File new.py, line 1, in module import

Re: SSH using PEXPECT

2008-09-11 Thread yellowblueyellow
' --- -- does this look right? I am using windows and for reason it wont let me use pexpect even tho I have CYGWIN installed I get the following error Traceback (most recent call last): File new.py, line 1, in module import ssh_session File C:\Python25\lib\ssh_session.py, line

SSH using PEXPECT

2008-09-10 Thread yellowblueyellow
Hey , I need to SSH into a server .. (10.8.42.38) using pexpect the username is 'admin' and password is 'abc123' so far i have the following code import pexpect import sys import time import os foo = pexpect.spawn('ssh [EMAIL PROTECTED]') ssh_newKey = 'Are you sure you want to continue

Re: SSH using PEXPECT

2008-09-10 Thread Sean DiZazzo
On Sep 10, 6:04 pm, [EMAIL PROTECTED] wrote: Hey , I need to SSH into a server .. (10.8.42.38) using pexpect the username is 'admin' and password is 'abc123' so far i have the following code import pexpect import sys import time import os foo = pexpect.spawn('ssh [EMAIL PROTECTED

Pexpect echoes twice for each read

2008-09-09 Thread Sriram Rajan
For some reason, Using pexpect causes my output to echo twice when I connect from my MAC Darwin (10.4) to Linux (CentOS release 5 ): The program: - #!/usr/bin/python # Automatic scp to remote host # Input 1 : filename # Input 2 : destination folder # Input 3 : hostname import

Re: Problem with PEXPECT in Python

2008-06-05 Thread A.T.Hofkamp
On 2008-06-04, Mallikarjun Melagiri [EMAIL PROTECTED] wrote: Hi Noah, I am new to python. I'm trying to use pexpect. Following is my problem definition: I should have a script on my machine A, which should 'ssh' to machine B and from there it shud

Problem with PEXPECT in Python

2008-06-04 Thread Mallikarjun Melagiri
Hi Noah, I am new to python. I'm trying to use pexpect. Following is my problem definition: I should have a script on my machine A, which should 'ssh' to machine B and from there it shud copy a file to machine C thru 'scp'. Please help me. Regards

killing children spawned by pexpect

2008-05-19 Thread loorthu
I am noticing that pexpect kills any child that it is spawned when the parent is terminated using SIGINT (e.g Ctrl-C on the shell), but not when it is killed by SIGKILL (e.g 'kill -9' on the parent process). Here is a quick demo (tried on Linux 2.6.9 kernel): #!/usr/local/bin/python import

Re: get the pid of a process with pexpect

2008-05-06 Thread Karim Bernardet
Many thanks ! This is what I did for mytunnel.py : I use pexpect like this tunnel_command = '''bash -c ssh -N -R 60011:localhost:60002 [EMAIL PROTECTED] ''' com=echo \+str(ssh_tunnel.pid)+\ pids ... time.sleep(172800) in the bash script which calls mytunnel.py : ./mytunnel.py ${USERN

get the pid of a process with pexpect

2008-05-05 Thread Karim Bernardet
Hi I am using pexpect to do ssh tunneling and to open a vnc server (jobs on a grid cluster). When the job is canceled, these 2 processes remain on the worker node (they are detached), so I have to kill them (using a trap command in the bash script of the job) but I need the pid of each

Re: get the pid of a process with pexpect

2008-05-05 Thread Nick Craig-Wood
Karim Bernardet [EMAIL PROTECTED] wrote: Hi I am using pexpect to do ssh tunneling and to open a vnc server (jobs on a grid cluster). When the job is canceled, these 2 processes remain on the worker node (they are detached), so I have to kill them (using a trap command in the bash

Re: get the pid of a process with pexpect

2008-05-05 Thread Noah
On May 5, 7:18 am, Karim Bernardet [EMAIL PROTECTED] wrote: ssh_tunnel = pexpect.spawn (tunnel_command % globals()) ... print ssh_tunnel.pid but ssh_tunnel is not the pid of the ssh tunnel Is there a way to get it using pexpect ? You will notice that you can't get this information even

Re: Pexpect question.

2008-04-03 Thread Jorgen Grahn
funciton. OK. Hope my note helped. I looked for pexpect doucment on http://www.noah.org/wiki/Pexpect, but the documentaiton link appear to be broken. Could you recommend another site? As I recall it, the online documentation is just the documentation from the Python module itself, HTML-formatted

Re: Pexpect question.

2008-04-02 Thread Paul Lemelle
Jorgen, Thanks for your reply. The ssh function is just a small part of what I would like to accomplish. And yes, chk is undefined, I was trying to figure out why control was not being returned from the sshcon funciton. I looked for pexpect doucment on http://www.noah.org/wiki/Pexpect

Re: Pexpect question.

2008-03-30 Thread Jorgen Grahn
On Fri, 28 Mar 2008 08:12:36 -0700 (PDT), Paul Lemelle [EMAIL PROTECTED] wrote: I am trying separate a script that users pexpect into various functions within the same expect session. The problem is that the function does not return control back Main. I do not understand what that sentence

pexpect

2008-03-29 Thread Paul Lemelle
I am trying separate a script that users pexpect into various functions within the same expect session. The problem is that the function does not return control back Main. Any insight into this issue would be greatly appreciated. Below is sample code of the problem. Thanks, Paul

Pexpect question.

2008-03-28 Thread Paul Lemelle
I am trying separate a script that users pexpect into various functions within the same expect session. The problem is that the function does not return control back Main. Any insight into this issue would be greatly appreciated. Below is sample code of the problem. Thanks, Paul

Re: Why my program (using pexpect to switch user) doesn't work well?

2008-01-12 Thread BlackjadeLin
=user_B child =pexpect.spawn('su user_B') child.expect('Password:') child.sendline(passwd) child.expect('$') child.close() Maybe it's the easiest pexpect program.Sometimes ,it work well,it switch to user_B successfully .But after i type the command exit to switch back to user_A,execute

Why my program (using pexpect to switch user) doesn't work well?

2008-01-10 Thread BlackjadeLin
I'm new to python I want to write a simple script to switch user,for example,from user_A to user_B. This my codes: #!/usr/bin/python import pexpect import os passwd=user_B child = pexpect.spawn('su user_B') child.expect('Password:') child.sendline(passwd) child.expect('$') child.close() Maybe

Re: Why my program (using pexpect to switch user) doesn't work well?

2008-01-10 Thread Noah
:') child.sendline(passwd) child.expect('$') child.close() Maybe it's the easiest pexpect program.Sometimes ,it work well,it switch to user_B successfully .But after i type the command exit to switch back to user_A,execute the python script again,it can't work,do nothing or just waiting.Why

pexpect - not printing more than 80 columns

2008-01-04 Thread Maximilian N. Andrews
Dear All, I'm trying to write a script which will check the progress of my MD-simulations on a cluster. So far I've been able to ssh to each node and retrieve the data I was looking for by sending the command top -c -n 1|grep mdrun with pexpect. Unfortunately the string I'm looking

Re: pexpect ssh login and ls | grep

2008-01-01 Thread Karthik Gurusamy
xterm, to update title bar. 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] ? I don't think your expect worked fine to capture the desired output. This is what I get: import pexpect child=pexpect.spawn('ssh [EMAIL

Re: how to connect to a remote machine using python........ pexpect help

2008-01-01 Thread vinoj davis
Hi,My aim is to connect to a remote machine and execute commands at the remote machine.. such as ifconfig...i found out a module named pexpect if anyone can help me out in thatThanking youRegards, ---ViNOJ DAViS---Regards

Re: pexpect ssh login and ls | grep

2008-01-01 Thread Dikkie Dik
shell_cmd = 'ls -l | grep mytest.log' child = pexpect.spawn ('ssh [EMAIL PROTECTED]') I think you can give the ssh command an option to execute a file remotely. That way, one command would be enough. -- http://mail.python.org/mailman/listinfo/python-list

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
. Can someone provide little insight on this? import pexpect child=pexpect.spawn('ssh [EMAIL PROTECTED] ls mytest.log /dev/null 21; echo $?') child.expect([pexpect.TIMEOUT, '\$']) Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.4/site-packages

Using pexpect with cgi

2008-01-01 Thread vinoj davis
I am using pexpect with Cgi to ssh into remote machine,Whenever i run a script which does ssh using pexpect from the linux terminal it gives me the correct result, but when i call the script using commands module from the cgi program i am getting the following error.(0, '(256, \'Traceback (most

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

Re: pexpect ssh login and ls | grep

2007-12-31 Thread Cameron Laird
In article [EMAIL PROTECTED], crybaby [EMAIL PROTECTED] wrote: 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

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.spawn

Re: Pexpect and a Linux Terminal

2007-12-26 Thread [EMAIL PROTECTED]
= '.*#' to detect the prompt expect. Thank you for you'r help ! Vive Python et TK :-D I have another probleme, not directly from Pexpect() function. There is my code : from Tkinter import * from sys import * import tkMessageBox from tkColorChooser import askcolor from tkFileDialog

Re: Pexpect and a Linux Terminal

2007-12-25 Thread [EMAIL PROTECTED]
Yes it's work ! :-D I use prompt = '.*#' to detect the prompt expect. Thank you for you'r help ! Vive Python et TK :-D -- http://mail.python.org/mailman/listinfo/python-list

Re: Pexpect and a Linux Terminal

2007-12-25 Thread [EMAIL PROTECTED]
On 25 déc, 09:41, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes it's work ! :-D I use prompt = '.*#' to detect the prompt expect. Thank you for you'r help ! Vive Python et TK :-D I have another probleme, not directly from Pexpect() function. There is my code : from Tkinter import * from

Re: Pexpect and a Linux Terminal

2007-12-25 Thread [EMAIL PROTECTED]
Pexpect() function. There is my code : from Tkinter import * from sys import * import tkMessageBox from tkColorChooser import askcolor from tkFileDialog import askopenfilename import tkFileDialog as Selector from os.path import exists, join from os import pathsep import pexpect import

Re: Pexpect and a Linux Terminal

2007-12-25 Thread [EMAIL PROTECTED]
Pexpect() function. There is my code : from Tkinter import * from sys import * import tkMessageBox from tkColorChooser import askcolor from tkFileDialog import askopenfilename import tkFileDialog as Selector from os.path import exists, join from os import pathsep import pexpect import

Re: Pexpect and a Linux Terminal

2007-12-25 Thread prikar20
! Vive Python et TK :-D I have another probleme, not directly from Pexpect() function. There is my code : from Tkinter import * from sys import * import tkMessageBox from tkColorChooser import askcolor from tkFileDialog import askopenfilename import tkFileDialog as Selector

Pexpect and a Linux Terminal

2007-12-24 Thread [EMAIL PROTECTED]
hello, I'm new in Python and i would like to use Pexpect to execute a root command (i want to mount via a Pyhton script a drive) so that's my script for the moment : from os import * import pexpect import os cmd1=su - cmd2=mount -o loop /home/user/my.iso /mnt/disk pwd=mypassword child

Re: Pexpect and a Linux Terminal

2007-12-24 Thread Karthik Gurusamy
On Dec 24, 6:06 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hello, I'm new in Python and i would like to use Pexpect to execute a root command (i want to mount via a Pyhton script a drive) so that's my script for the moment : from os import * import pexpect import os cmd1=su - cmd2

Re: Pexpect and a Linux Terminal

2007-12-24 Thread Michael Bentley
On Dec 24, 2007, at 7:06 PM, [EMAIL PROTECTED] wrote: hello, I'm new in Python and i would like to use Pexpect to execute a root command (i want to mount via a Pyhton script a drive) so that's my script for the moment : from os import * import pexpect import os cmd1=su - cmd2=mount

Valgrind and pexpect

2007-12-20 Thread Salvatore Iovene
Hi, I'm using the pexpect module to spawn some processes in a testing environment. pexpect uses, internally, os.execv. What I need to do is valgrind python and get memory leaks from the spawned children (assuming that python doesn't leak :)). Here's a simple testcase: === leak.c

Problem with PEXPECT in Python

2007-10-23 Thread jai simhan
import sys,os import pexpect source_file= 'sourcefile.txt' user='username' ip='00.00.00.00' desti_path='/home/jai/………' password='bond007' cmd ='scp'+' '+source_file+' '+user+'@'+ip+':'+desti_path try: foo = pexpect.spawn(cmd) foo.expect('.ssword

Re: Problem with PEXPECT in Python

2007-10-23 Thread Laszlo Nagy
cmd ='scp'+' '+source_file+' '+user+'@'+ip+':'+desti_path You might wanna try to login with a public/private key pair, then scp won't ask for a password. -- http://mail.python.org/mailman/listinfo/python-list

Closing pexpect connections using threads

2007-10-03 Thread Vishal Sethia
I am trying to write a multi-threaded program and use pexpect along with it. All works fine until I try to close the connection handle. That thread keeps waiting until the connection handle closes. It actually never comes out of that command(connection_handle.close()). If I manually kill it using

Pexpect, SSH, and CVS

2007-07-17 Thread Ben Snider
Hello all, So I'm setting up a script that runs when CVS wants to connect to an ext type server by setting CVS_RSH to my script so I can log in with a password. IE CVS_RSH=/etc/projects/blah.py. Which runs when I type say cvs -d:ext:[EMAIL PROTECTED]:/cvsroot co module. I need this because of

Re: Problem with PEXPECT in Python

2007-07-02 Thread Noah
Kevin Erickson wrote: On Jun 30, 5:50 pm, Kevin Erickson [EMAIL PROTECTED] wrote: #Begin Code import sys import pexpect def GetServerData(self): foo = pexpect.spawn('scp [EMAIL PROTECTED]:/home/config/ role{/file1,/files/file2,/files/file3} /tmp

Problem with PEXPECT in Python

2007-06-30 Thread Kevin Erickson
Hello, I am attempting to use pexpect in python to copy files from a server using scp; the copy works however exceptions are thrown and it exits unsuccessfully. Below is the a sample code and the error: #Begin Code import sys import pexpect def GetServerData(self): foo

Re: Problem with PEXPECT in Python

2007-06-30 Thread Kevin Erickson
On Jun 30, 5:50 pm, Kevin Erickson [EMAIL PROTECTED] wrote: Hello, I am attempting to use pexpect in python to copy files from a server using scp; the copy works however exceptions are thrown and it exits unsuccessfully. Below is the a sample code and the error: #Begin Code import sys

pexpect/termios error: Inappropriate ioctl for device

2007-05-31 Thread Laszlo Nagy
Hi All, I have a python program that downloads database backups from a remote server, and tries to replace the local database with the downloaded backup. The database is a PostgreSQL server and my program calls the pg_restore command with the aid of the wonderful pexpect module. Everything

Pexpect: SSH, Command and Password

2007-04-04 Thread Gil_H
at the last part (3) of the password request). I don't have any errors when trying to operate the script without the last password. Here is the script: import pexpect import sys import re import os import getopt PROMPT = \$|\%|\ class SSH: def __init__(self, user, password, host

Re: Pexpect: SSH, Command and Password

2007-04-04 Thread Ganesan Rajagopal
Gil == Gil H [EMAIL PROTECTED] writes: class SSH: def __init__(self, user, password, host): self.child = pexpect.spawn(ssh [EMAIL PROTECTED]%(user, host)) Try adding the following line here self.child.logfile = sys.stdout That should give you some clue.

Re: Pexpect: SSH, Command and Password

2007-04-04 Thread Gil_H
On 4 Apr, 15:14, Ganesan Rajagopal [EMAIL PROTECTED] wrote: Gil == Gil H [EMAIL PROTECTED] writes: classSSH: def __init__(self, user, password, host): self.child =pexpect.spawn([EMAIL PROTECTED]%(user, host)) Try adding the following line here

Re: pexpect regex help

2007-02-23 Thread amadain
On Feb 21, 11:15 pm, [EMAIL PROTECTED] wrote: On Feb 21, 6:13 pm, [EMAIL PROTECTED] wrote: I have apexpectscript to walk through a cisco terminal server and I was hoping to get some help with this regex because I really suck at it. This is the code: index =

Re: pexpect regex help

2007-02-23 Thread amadain
On Feb 23, 8:46 am, amadain [EMAIL PROTECTED] wrote: On Feb 21, 11:15 pm, [EMAIL PROTECTED] wrote: On Feb 21, 6:13 pm, [EMAIL PROTECTED] wrote: I have apexpectscript to walk through a cisco terminal server and I was hoping to get some help with this regex because I really suck at

Re: pexpect regex help

2007-02-23 Thread amadain
On Feb 23, 8:53 am, amadain [EMAIL PROTECTED] wrote: On Feb 23, 8:46 am, amadain [EMAIL PROTECTED] wrote: On Feb 21, 11:15 pm, [EMAIL PROTECTED] wrote: On Feb 21, 6:13 pm, [EMAIL PROTECTED] wrote: I have apexpectscript to walk through a cisco terminal server and I was hoping to

pexpect regex help

2007-02-21 Thread jonathan . sabo
I have a pexpect script to walk through a cisco terminal server and I was hoping to get some help with this regex because I really suck at it. This is the code: index = s.expect(['login: ', pexpect.EOF, pexpect.TIMEOUT]) if index == 0: m = re.search('((#.+\r\n){20,25

Re: pexpect regex help

2007-02-21 Thread jonathan . sabo
On Feb 21, 6:13 pm, [EMAIL PROTECTED] wrote: I have a pexpect script to walk through a cisco terminal server and I was hoping to get some help with this regex because I really suck at it. This is the code: index = s.expect(['login: ', pexpect.EOF, pexpect.TIMEOUT]) if index

pexpect problems

2006-11-24 Thread flynnguy
I am trying to essentially fork a rsync process from my python script and I am having some issues with the forking part. My program basically checks to see if I need to transfer a file and if it does, it calls the transferItem() function below: def transferItem(filelist): hostname, passwd,

how can I send several command by useing pexpect ssh

2006-11-05 Thread haishan chang
I have studied pexpect example sshls.py and ssh_session.py, trying to carry several linux command by ssh. for example. 1. ssh connect one remotehost, 2. cd /tmp directory 3. mkdir myname 4. touch output.log But I found these examplesonly can carry one command.who knows how to carry sereval linux

problem controlling/displaying video thru pexpect

2006-11-02 Thread mavicdog
I am developing a small appl. for a student to code some video. I am able to control mplayer in slave mode through IDLE using pexpect. In my app though I want to display it in a particular frame and have buttons control rw ff, stop, play etc... I am having two problems. One how do I frame

Get pexpect to work

2006-10-29 Thread Jurian Sluiman
Hi all, For my first script, I'm trying to build a program to set up a vpn connection. I'm using pexpect to handle this, but I can't get it to work. The sendline() is causing troubles. I tested it in the interactive promt, with these results: import pexpect child = pexpect.spawn(vpnc-connect

Re: Get pexpect to work

2006-10-29 Thread Jurian Sluiman
Ok, somebody helped my and found with help(child.sendline) that the number (7) is the number of characters from my password. Still there doesn't seem to be that anything strange is happening. With the logfile printed out, I found that child.expect places a 0 behind the next rule. Is this always

Re: Get pexpect to work

2006-10-29 Thread drake
Jurian Sluiman wrote: Ok, somebody helped my and found with help(child.sendline) that the number (7) is the number of characters from my password. Still there doesn't seem to be that anything strange is happening. With the logfile printed out, I found that child.expect places a 0 behind the

Get pexpect to work

2006-10-28 Thread Jurian Sluiman
Hi all, I'm trying to build a program to set up a vpn connection. I'm using pexpect to handle this, but I can't get it to work. The sendline() is causing troubles. I tested it in the interactive promt, with these results: import pexpect child = pexpect.spawn(vpnc-connect tudelft

Re: pexpect with apache

2006-10-19 Thread [EMAIL PROTECTED]
the authentication in pexpect. I had added 'www' to user 'admin', and could su to root from the command line, so I don't think that was it. Maybe it was a timing error, ie pexpect fired off the password too soon or too late, or something in the apache environment that just disallowed becoming root for security

Re: pexpect with apache

2006-10-18 Thread martdi
line and the share is made. But when I try to have the web server execute it, I continually get a password failure. I'm positive the password is correct. Any ideas? ~Sean D ~~~test.py #! /usr/bin/env python import commands, os, P, pexpect sharename = sys.argv[1] root

Re: pexpect with apache

2006-10-18 Thread Lee Harr
Well, first i don't think it is a good idea to have the python script tu su to root, but for it to work, i think (Totally unsure about that) www has to be in group wheel to be able to su. Maybe sudo can help here. -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   >