Python Documentation?
Gerhard Häring
gh at ghaering.de
Mon Sep 1 12:08:24 EDT 2003
Cc-ing python-list because it might be of general interest.
Cameron Laird wrote:
> In article <mailman.1062427383.11085.python-list at python.org> you write:
>>[1] If nothing else, I could then add "does anybody actually directly
>>use this cra^wmodule?" to the page for ftplib <0.1 wink>
>>
>
> What *is* going on there? Do you use Twisted instead?
I needed a quick way to "stat" files via FTP (it's a mirror script that
synchronizes the maps, etc. on Unreal Tournament 2003 gameservers). As
ftplib lacks any methods whatsoever to parse the output of the LIST
command, I searched for something higher level and found ftputil [1],
which is quite nice to use.
Unfortunately, the stat command of ftputil was very inefficient (it
basically does a LIST for every stat() you call), so I extended it with
a statall() method for my mirror script.
Being annoyed with Python's ftplib I wasn't surprised that the ftpcp
function in the module didn't work for me, while calling the Linux ftp
client (well, whatever /usr/bin/ftp was at that machine ;-) worked fine
when using the appropriate PROXY commands.
My current solution creates a script that is then fed into the ftp
client program. Yes, I need an appropriate ~/.netrc file :-/ It's quite
a hack, but I needed a solution fast ;-)
The good part was [2] that I learnt that FTP actually has one useful
feature: server-to-server copy, which has the additional benefit of not
creating any significant traffic on the controlling client.
-- Gerhard
[1] http://www.ndh.net/home/sschwarzer/python/python_software.html
[2] thanks to deltab on #python
More information about the Python-list
mailing list