changing umask from ftplib
Steffen Ries
steffen.ries at sympatico.ca
Tue Aug 8 07:37:44 EDT 2000
j vickroy <jvickroy at sec.noaa.gov> writes:
> 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?
The FTP client translates the commands you enter into commands the FTP
server understands. 'UMASK' is not a supported command, but is
available on unix hosts through the 'SITE' command. -> try:
ftp.sendcmd('SITE UMASK 113')
(`man ftpd' may give you an insight)
/steffen
--
steffen.ries at sympatico.ca <> Gravity is a myth -- the Earth sucks!
More information about the Python-list
mailing list