FTP Windows AS/400

Tim G. tgraber_us at yahoo.com
Tue Sep 13 12:31:56 EDT 2005


I am trying to execute a win python script that connects to an AS/400;
changes from the native lib to the IFS file system; then, changes to a
directory in IFS; gets a file.

Any help would be greatly appreciated.

I cannot get the script to switch from native to IFS.  I get the
following error:

Traceback (most recent call last):
  File "C:\Python24\Tools\scripts\ftp400.py", line 9, in ?
    ftp.cwd(path)
  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.

here is the script:

import ftplib, os

filename=''
path = "directory"
os.chdir('c:\\ftp_jde400')

ftp = ftplib.FTP('server', 'user', 'password')
ftp.sendcmd('site namefmt 1')
ftp.cwd(path)
#remotefiles = ftp.nlst()
#ftp.retrlines('LIST')
#for filename in remotefiles:
#    file = open(filename, 'wb')
#    ftp.retrbinary('RETR ' + filename, file.write, 1024)
#    file.close()
    
ftp.quit()




More information about the Python-list mailing list