Hallo ich bin am Programmieren mit Pycharm, doch wenn ich "run" klicke kommt "Process finished with exit code 0" was ist das?

2 Antworten

Vom Fragesteller als hilfreich ausgezeichnet

Ja, das heißt dass das Programm ohne Fehler fertig gelaufen ist. Es liegt an deinem Programmcode ob etwas ausgegeben wird oder nicht, und scheinbar wird nichts ausgegeben. Um etwas auszugeben musst du in deinem Programm

print("irgendwas")

einbauen.

Woher ich das weiß:Hobby – Programmiere seit eineinhalb Jahren
Process finished with exit code 0

Das heißt das das Programm ohne fehler durchgelaufen und beendet ist.

Wenn du den Code mitschicken könntest könnte ich mehr sagen.
ggf. rufst du einfach keine methode auf o.ä.

Woher ich das weiß:eigene Erfahrung

SrapBlitz4444 
Fragesteller
 07.06.2021, 17:21
import speech_recognition as sr
import pyttsx3
import pywhatkit
import datetime
import wikipedia
import pyjokes

listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)


def talk(text):
    engine.say(text)
    engine.runAndWait()


def take_command():
    try:
        with sr.Microphone() as source:
            print('listening...')
            voice = listener.listen(source)
            command = listener.recognize_google(voice)
            command = command.lower()
            if 'alexa' in command:
                command = command.replace('alexa', '')
                print(command)
    except:
        pass
    return command


def run_alexa():
    command = take_command()
    print(command)
    if 'play' in command:
        song = command.replace('play', '')
        talk('playing ' + song)
        pywhatkit.playonyt(song)
    elif 'time' in command:
        time = datetime.datetime.now().strftime('%I:%M %p')
        talk('Current time is ' + time)
    elif 'who the heck is' in command:
        person = command.replace('who the heck is', '')
        info = wikipedia.summary(person, 1)
        print(info)
        talk(info)
    elif 'date' in command:
        talk('sorry, I have a headache')
    elif 'are you single' in command:
        talk('I am in a relationship with wifi')
    elif 'joke' in command:
        talk(pyjokes.get_joke())
    else:
        talk('Please say the command again.')


while True:
    run_alexa()

Ich habe das von Youtube und wollte es verändern... aber ich kann es nicht verändern, wenn das "Original" nicht funktioniert... (es soll eine art alexa werden)

0