1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Trying to FTP file using python script to Mainframe server, but getting special...

Discussão em 'Python' iniciado por Stack, Setembro 16, 2025.

  1. Stack

    Stack Membro Participativo

    Trying to FTP file using python script to Mainframe server, but getting special characters at mainframe dataset end

    from ftplib import FTP

    host = "hostname"
    user = "username"
    password = "pass"

    with FTP(host) as ftp:
    ftp.login(user = user, passwd = pass)
    print(ftp.getwelcome())

    with open('test.txt', 'rb') as f:
    ftp.storbinary('STOR ' + "'TestDataset'", f)

    ftp.quit()


    This is the code which I have used to FTP a file to mainframe server, looks like encoding issue. Mainframe uses EBCDIC and python default encoding has UTF-8 or UTF-16, but not able to resolve it, please help. Thank you

    This is the output which I'm able to see at mainframe end, Content of text.txt is "Hi there"

    [​IMG]

    Continue reading...

Compartilhe esta Página