Search code examples
pythoninputasciimatics

RuntimeError: input(): lost sys.stdin - Directly after an asciimatic's animation


I was curious if anyone had any insight to this error I am having. I have a program in python that run's an intro-animation using asciimatics. Following this animation, I attempt to get input from the user using input(), but get the following error -> RuntimeError: input(): lost sys.stdin. I know asciimatics has to take some control so sys.stdin/sys.stdout, and perhaps this is the root of the problem.

Animation

def demo(screen):
    scenes = []
    scenes.append(PlasmaScene(screen))
    screen.play(scenes, stop_on_resize=True, repeat=False)

def main():
    Screen.wrapper(demo)

Where it's called

clear()
animate_intro() # asciimatic animation
clear()

LOGGED, USER = login_entry(None) # input() called in 'login_entry()'

Error Thrown

RuntimeError: input(): lost sys.stdin

Solution

  • As discussed... This appears to be some complex interaction between asciimatics use of win32 and the cmd command prompt on windows.

    It wasn't reproducible on my system, but using subprocess.run("python games/life.py") instead of os.system appears to have fixed it.