changing umask from ftplib

j vickroy jvickroy at sec.noaa.gov
Mon Aug 7 11:49:12 EDT 2000


I am having difficulty using the sendcmd() method of the FTP class in
the ftplib module.  The ftpmirror.py example that comes with the Python
1.5.2 distribution does not appear to cover this, and I guess I don't
understand the online documentation either.  In any event, this is an
example:

>>>
>>> import ftplib
>>> ftp = ftplib .FTP ('the_machine','the_user','the_password')
>>> result = ftp .sendcmd ('umask 113')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/local/Python-1.5.2_threads_work/Lib/ftplib.py", line 228, in
sendcmd
    return self.getresp()
  File "/local/Python-1.5.2_threads_work/Lib/ftplib.py", line 201, in
getresp
    raise error_perm, resp
ftplib.error_perm: 500 'UMASK 113': command not understood.
>>>

However, I can issue the command from an ftp session as follows:

230 User the_user logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> umask 113
200 UMASK set to 113 (was 022)

What am I doing wrong?

Thanks for your time.





More information about the Python-list mailing list