Python & autoftp

Cameron Laird claird at starbase.neosoft.com
Tue Apr 23 13:57:23 EDT 2002


In article <aa42gi$6jg$1 at nntp6.u.washington.edu>,
Donn Cave <donn at u.washington.edu> wrote:
>Quoth davies at jkevin.freeserve.co.uk (kevin):
>| I'm pretty new to Python and I would like to develop a script in
>| Python to automatically FTP. I have already used bash and expect and
>| now would like to replace bash entirely with Python.
>|
>| Is there any merit in replacing bash with Python??
>
>In general, each is superior in its own domain of application.
>More specifically, if your program works fine now, it probably
>won't work any better in Python, but you may learn something
>about Python and UNIX internals while you're at it.
>
>| Can anyone point me in the right direction.
>
>The expect part is probably the hardest.  I assume you mean to
>replace expect too, not just bash.  Look at openpty and forkpty
>in the posix ("os") module, and see if you can get them to work
>in a little test application (if you even have them.)  There
>are also more complete expect solutions, if that's interesting
>you might look in the Vaults of Parnassus exit from www.python.org.
>
>Alternatively, whatever you're doing might be done more easily
>by replacing ftp itself with ftplib module.  That will make the
>expect part unnecessary.
>
>	Donn Cave, donn at u.washington.edu

In the year 2002, what I emphasize the most is that
the Expect part is unnecessary.  It has been, in fact,
for about a decade; even most vanilla shell scripts
which do FTP work don't really need the PTY-management
of Expect <URL: http://
starbase.neosoft.com/~claird/comp.unix.programmer/ftp_automation.html >.

If you want to work with Python for automation of FTP
operations, I STRONGLY recommend the ftplib module.
That's much the best way to advance.

I agree with the rest of what Donn's written, of
course.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list