none
The program '[54148] pythonw.exe' has exited with code 0 (0x0). RRS feed

  • Question

  • Hi!! Im just start learning creat some AL by python code and that problem just show when im trying to start my code.I don´t know what to do because This is my first time i have this so please help me.Thanks 

    This is my code:

    import speech_recognition
    import pyttsx3
    from datetime import date
    from datetime import datetime 

    robot_ear = speech_recognition.Recognizer()
    robot_mouth = pyttsx3.init()
    robot_brain = ""

    while True:
        with speech_recognition.Microphone() as mic:
            print("Robot: I´m Listening")
            audio = robot_ear.listen(mic)

        print("Robot: ...")


        try:
            you = robot_ear.recognize_google(audio)
        except:
            you = ""

        print("You:  " = you)


        if you == "":
            robot_brain = "I cant hear you,try again"
        elif you == "hello":
            robot_brain = "hello sir"
        elif "hello" in you:
            robot_brain = "Hello sir"
        elif "today" in you:
            today = date.today()
            robot_brain = today.strftime("%B %D,  %Y")
        elif "time" in you:
            now = datetime.now()
            robot_brain = now.strftime("%H hours %M minutes %S seconds")
        elif you == "today":
            today = date.today()
            robot_brain = today.strftime("%B %d, %Y")
        elif you == "time":
            now = datetime.now()
            robot_brain = now.strftime("%H hours %M minutes %S seconds")
        elif "president of USA" in you:
            robot_brain ="Donald Trump"
        elif "bye" in you:
            robot_brain = "Good Bye,sir"
             print("Robot: " + robot_brain)
             robot_mouth.say(robot_brain)
             robot_mouth.runAndWait()
             break
        else:
            robot_brain = "im fine thank you and you"

        print("Robot: " + robot_brain)
        robot_mouth.say(robot_brain)
        robot_mouth.runAndWait()

    Saturday, July 4, 2020 10:55 PM

All replies

  • Hi! Please read this article about debugging Python in Visual Studio.

    Come here next time when/if you get a VC++ question.

    -- pa

    Saturday, July 4, 2020 11:14 PM
  • One thing to remember for future problems is that 0 tends to be used for success. It is common convention for an application to return 0 when it executed without any problems.

    So while your problem is off topic for the C++ forum (where it was originally posted), the fact that the python interpreter returned 0 shows that it ran without issue at the very least.


    This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    • Proposed as answer by Tim Roberts Monday, July 6, 2020 11:42 PM
    Sunday, July 5, 2020 9:33 AM
  • Hello,

    this is the Visual C++ forum. You should ask in a python forum, e.g.:

    https://python-forum.io/

    Regards, Guido

    Monday, July 6, 2020 5:59 AM