Skip to content

pty option not working as expected in Python 3.14 #1052

@tim-s-ccs

Description

@tim-s-ccs

I have some tasks that use an interactive terminal however when running those tasks with Python 3.14 the keyboard inputs are not passed through.
I'm not sure my understanding of the issue is good enough to explain it but I have created an example below which should demonstrate the issue:


tasks.py

from invoke import task

@task
def run(c):
    c.run("python main.py", pty=True)

main.py

#!/usr/bin/env python3

def main():
    result = input("Please enter some text: ")

    print(f"This is what you input: {result}")

if __name__ == '__main__':
    main()

When I run this with Python 3.13 or older it accepts the input and prints the result:

invoke run
Please enter some text: Some text
This is what you input: Some text

When I run this with Python 3.14, the input is not accepted and actually no keyboard inputs seem to go through including ctrl C to kill the process:

invoke run
Please enter some text: Some text
^C^C
^C^C

I am using pyenv to manage the Python versions (which is 3.14.0 to be exact) and I'm on macOS Sequoia Version 15.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions