Accessing Mainframe datasets using FTP form Python

2k views Asked by At

I want to download a dataset from mainframe using Python ftplib.

I am able to login to mainframe and I get default working directory as "CY$$." I want to change the working directory to "CY01." I tried using ftp.cwd('CY01.') but it changes the directory to "CY$$.CY01." instead of just "CY01."

While using command prompt I use below command to successfully change working directory:

CD 'CY01.'

(a '.' at end of directory name is IBM command to change default working directory and not append it to defualt directory)

I also tried ftp.sendcmd("CD 'CY01.'") but it gives error "500 unknown command CD"

Can someone please help with changing the defualt working directory? Thanks in advance.

1

There are 1 answers

0
Parth Karia On

ftplib ccommand ftp.cwd("'CY01'") works fine. Have been using it for over a year now.