[Python] pyttsx3 .runAndWait stops working after first execution

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

  1. Stack

    Stack Membro Participativo

    I am working on a piece of code where the functionality of runAndWait is required multiple times (a spelling game where the user has to input spellings being read aloud)

    Consider the following code snippet (not from the actual code, but similar enough to what I want):

    import pyttsx3

    engine = pyttsx3.init()
    engine.say("Hello World")
    engine.runAndWait()
    engine.stop()

    engine.say("Hi")
    engine.runAndWait()
    engine.stop()



    When run, I would expect it to say both "Hello World", then "Hi", however it only says "Hello World" when ran.
    Why is this the case?
    Are there any workarounds?

    Continue reading...

Compartilhe esta Página