ftplib sendcmd

Fredrik Lundh effbot at telia.com
Mon Apr 24 12:35:05 EDT 2000


Bill Scherer <scherbi at bam.com> wrote:
> I'm having trouble with ftplib's sendcmd method (Python 1.5.2 on RH
> linux 6.1):
>
> >>> ftp = ftplib.FTP(host, user, password)
> >>> ftp.sendcmd('umask 002')
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python1.5/ftplib.py", line 228, in sendcmd
>     return self.getresp()
>   File "/usr/local/lib/python1.5/ftplib.py", line 201, in getresp
>     raise error_perm, resp
> ftplib.error_perm: 500 'UMASK 002': command not understood.
> >>>
>
> The umask command does, of course, work using a standard ftp client to
> the same host.
>
> Other commands, chmod, etc, suffer equal fate.
>
> Is this not what sendcmd is for? What am I doing wrong?  Thanks!

sendcmd is used to send FTP protocol commands, which
is not the same as the commands you type into your ftp
client...

to see what your client sends, try running the client in
debug mode (-d on my box.  ymmv).  or you can look it
up in the FTP specification (RFC 959).

(iirc, there is no umask command in the standard FTP
protocol, but I might be wrong...)

</F>





More information about the Python-list mailing list