Mon code python google search ne fonctionne pas

Fermé
Dorian - 14 sept. 2022 à 19:43
 noplou - 15 sept. 2022 à 21:14

Bonjour,

J'ai écrit un code python qui me sert a faire des recherches google, mais quand me programme me dit de dire ma recherche, la recherche ne se lance pas.

Quelqu'un pourrez m'aider s'il vous plaît ? 

def recherche():
    talk("Que voulez-vous rechercher ?")
    engine.runAndWait()
    with sr.Microphone() as source:
        print("Dites votre recherche")
        voice = listener.listen(source)
        command = listener.recognize_google(voice, language="fr-FR")
        command = command.lower()
        print(command)
        if "opale" in command:
            command = command.replace("opale", "")
        print(command)
    mySearch = input()
    webbrowser.open("https://www.google.com/search?q=" + mySearch)
A voir également:

1 réponse

yg_be Messages postés 23535 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 27 avril 2025 Ambassadeur 1 579
14 sept. 2022 à 23:22

bonjour,

es-tu certain de nous avoir montré tout ton code?

0

oui je l'ai joint avec, je le remet ci-dessous :

def recherche():
    with sr.Microphone() as source:
        print("Dites votre recherche")
        voice = listener.listen(source)
        command = listener.recognize_google(voice, language="fr-FR")
        command = command.lower()
        print(command)
        if "opale" in command or "recherche pour moi" in command:
            command = command.replace("opale", "")
            print(command)
        mySearch = input()
        webbrowser.open("https://www.google.com/search?q=" + mySearch)
    return command
0
noplou > Dorian
15 sept. 2022 à 21:14

Bonsoir, il n'y a forcément pas tout, puisque tu utilises des bibliothèques additionnelles, de plus on ne sait comment est appelée cette fonction.

1