[Python] Trouble while launching Mainframe Terminal TN3270.ws via Python

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am currently working on a Python-based automation task that involves interacting with a mainframe terminal. As part of the requirement, I need to:

    1. Launch the mainframe terminal.
    2. Enter the username and password.
    3. Perform a series of interactions (e.g., pressing specific keys).
    4. Extract data from the terminal screen.

    To achieve this, I attempted to use the py3270 library by specifying the hostname and port. However, I am encountering the following error:


    [WinError 10061] No connection could be made because the target machine actively refused it
    ​

    Below is the code snippet I am using:

    from py3270 import Emulator

    # Launch the terminal with visibility enabled
    em = Emulator(visible=True)

    # Attempt to connect to the mainframe host
    print("Connecting to mainframe...")
    em.connect('HostName:portNumber')
    print("Connection established.")


    What is causing this issue?

    Continue reading...

Compartilhe esta Página