FTP Error: Windows AS/400
Peter A. Schott
paschott at no.yahoo.spamm.com
Tue Sep 13 19:03:00 CEST 2005
I've used DOS FTP to hit AS/400 systems before and usually have to completely
qualify the file name or ensure that I'm in the correct directory. When you use
command-line FTP to get the file, do these commands mimic your commands?
What version of python are you using?
If you issue PWD on the FTP site, what is returned when you're in the correct
folder? Can you use the sendcmd() function to mimic the functionality of cwd()
for this purpose?
I don't have easy access to an AS/400 with which to test, but maybe there's an
idea or two here that's worth trying.
"Tim G." <tgraber_us at yahoo.com> wrote:
> 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