By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,931 Members | 1,976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,931 IT Pros & Developers. It's quick & easy.

FTP Error: Windows AS/400

P: n/a
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.
Code:

import ftplib, os

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

ftp = ftplib.FTP('test400')
ftp.login('oneworld', 'onew0r1d')
#ftp.sendcmd('quote site namefmt 1')
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()
Error:

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

Sep 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

-Pete

"Tim G." <tg********@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.
Code:

import ftplib, os

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

ftp = ftplib.FTP('test400')
ftp.login('oneworld', 'onew0r1d')
#ftp.sendcmd('quote site namefmt 1')
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()
Error:

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

Sep 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.