Can Python replace TCL/Expect

X

xinchenvn

Hi

I'm learning Python. I don't know whether Python can do something like
Expect can do. If yes, please show me how to do it.
I want to do something automatically: open connection to a ftp server,
get the welcome message on the screen (not in the packet). I can do it
easily with Expect but I still don't have any idea with Python.
If possible, can you introduce me some book or website that I can get
infor about automation programming with Python

Thanks
 
R

Robert Kern

Hi

I'm learning Python. I don't know whether Python can do something like
Expect can do. If yes, please show me how to do it.
I want to do something automatically: open connection to a ftp server,
get the welcome message on the screen (not in the packet). I can do it
easily with Expect but I still don't have any idea with Python.
If possible, can you introduce me some book or website that I can get
infor about automation programming with Python

You'll probably want to take a look at pexpect:

http://pexpect.sourceforge.net/

--
Robert Kern
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 
C

Cameron Laird

You'll probably want to take a look at pexpect:

http://pexpect.sourceforge.net/
.
.
.
1. Yes.
2. While Pexpect indeed "can do something like Expect",
it does NOT have all the facilities and polish of the
latter.
3. But very, VERY few of Expect's users are aware of more
than a handful of Expect's functions, let alone use them,
so it's fair to say that Pexpect does everything Expect
does, within the realm of ordinary use.
4. But it sort-of doesn't matter anyway, because, if the
goal is (as appears in this case) to work with ftp,
there are better ways to work, anyway <URL:
http://phaseit.net/claird/comp.unix.programmer/ftp_automation.html >
<URL: http://www.python.org/doc/current/lib/ftp-handler-objects.html >.
 
J

Jorgen Grahn

....
2. While Pexpect indeed "can do something like Expect",
it does NOT have all the facilities and polish of the
latter.
3. But very, VERY few of Expect's users are aware of more
than a handful of Expect's functions, let alone use them,
so it's fair to say that Pexpect does everything Expect
does, within the realm of ordinary use.

It depends. I do not feel /that/ advanced, but I've been bitten by pexpect's
limitations several times in several places.

.... which puts me in a weird position ;-) I /loathe/ the Tcl language, but I
have to admit that its expect functionality is far superior to Python's.

/Jorgen
 
C

Cameron Laird

.
.
.
It depends. I do not feel /that/ advanced, but I've been bitten by pexpect's
limitations several times in several places.

... which puts me in a weird position ;-) I /loathe/ the Tcl language, but I
have to admit that its expect functionality is far superior to Python's.
.
.
.
'Salright. There are Tcl programmers who feel the same way,
for example, about Python and its object orientation.

On to more constructive matters: what are you doing about
Pexpect's limitations? Have the maintainers responded to you
when you write? Are you tempted to compose enhancements for
yourself?
 
J

Jorgen Grahn

.
.
.

On to more constructive matters: what are you doing about
Pexpect's limitations? Have the maintainers responded to you
when you write? Are you tempted to compose enhancements for
yourself?

There is hobby hacking, and there is work. I've encountered pexpect during
work, and haven't had the time and energy to look into it. I hereby
apologize to the pexpect developers. Not for whining, but for not helping
out.

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top