FTP Error: Windows AS/400

Tim G. tgraber_us at yahoo.com
Tue Sep 13 18:03:51 CEST 2005

I am trying to use Win Python to ftp files from an AS/400 IFS directory
down to my Windows machine.

I seem to get stuck when I am trying to send a command to the AS/400 to
switch file systems from native to IFS and then to issue a cd to my
folder.  I get the error below.

If anyone has had experience trying to ftp from a 400, I would greatly
appreciate any info on the topic.


import ftplib, os

path = "jde7333"

ftp = ftplib.FTP('test400')
ftp.login('oneworld', 'onew0r1d')
#ftp.sendcmd('quote site namefmt 1')
ftp.sendcmd('site namefmt 1')
#remotefiles = ftp.nlst()
#for filename in remotefiles:
#    file = open(filename, 'wb')
#    ftp.retrbinary('RETR ' + filename, file.write, 1024)
#    file.close()



Traceback (most recent call last):
  File "C:\Python24\Tools\scripts\ftp400.py", line 10, in ?
  File "C:\Python24\lib\ftplib.py", line 494, in cwd
    return self.voidcmd(cmd)
  File "C:\Python24\lib\ftplib.py", line 246, in voidcmd
    return self.voidresp()
  File "C:\Python24\lib\ftplib.py", line 221, in voidresp
    resp = self.getresp()
  File "C:\Python24\lib\ftplib.py", line 214, in getresp
    raise error_perm, resp
ftplib.error_perm: 501 Unknown extension in database file name.

More information about the Python-list mailing list