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

FTP Windows AS/400

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

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


P: n/a
Hi Tim,
On Tuesday 13 September 2005 17:31, Tim G. wrote:
I cannot get the script to switch from native to IFS.
Yes you can...
Traceback (most recent call last):
File "C:\Python24\Tools\scripts\ftp400.py", line 9, in ?
ftp.cwd(path)
It's the cwd which is having a problem
here is the script:

import ftplib, os

filename=''
path = "directory"


Change the path to an absolute path, eg:
ftp.sendcmd('site namefmt 1') '250 Now using naming format "1".' ftp.cwd('/home')

'250 "/home" is current directory.'

HTH
Sep 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.