2 réponses
-
Bonsoir, aucun rapport avec python, simplement avec la configuration de ton ide.
https://duckduckgo.com/?q=pycharm+can%26%2339%3Bt+find+main+module&t=h_&ia=web
-
Bonjour,
Il faudrait afficher ton code complet, mais pas de photo, copie-le ici avec les balises:
mode d'emploi:
https://codes-sources.commentcamarche.net/faq/11288-poster-un-extrait-de-code
Visuellement, ça doit ressembler à ça:
for k in range(10): print(k)-
oui désolé je vous le donne
import sys import pyttsx3 as ttx import speech_recognition as sr import pywhatkit import datetime import wikipedia import random import webbrowser from blagues_api import BlaguesAPI import asyncio import openai listener = sr.Recognizer() engine = ttx.init() voices = engine.getProperty("voices") print(voices) engine.setProperty('voice', voices[0].id) blagues = BlaguesAPI("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiOTI0OTkzMzE3NTkzMzA5MTk2IiwibGltaXQiOjEwMCwia2V5IjoibVV5VmlYTk9jUnpaV01pTHo5M2xZSzkzNDBhblVXSTlKNVRIUVJxV29KUGlvMzlyUVgiLCJjcmVhdGVkX2F0IjoiMjAyMi0wOS0xMFQwODo1MToyNCswMDowMCIsImlhdCI6MTY2Mjc5OTg4NH0.giZ6hNebzFOykyfiV1cpiIf7XxqA3ANbq0JEM9kqrJ4") def open_netflix(): webbrowser.open("https://www.netflix.com/browse") def open_youtube(): webbrowser.open("https://www.youtube.com") def open_google(): webbrowser.open("https://www.google.com") 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 def talk(text): engine.say(text) engine.runAndWait() async def jokes(): await blagues.random() def greetme(): current_hour = int(datetime.datetime.now().hour) if 0 <= current_hour < 12: talk("Bonjour !") if 12 <= current_hour < 18: talk("Bonne après-midi ") if current_hour >= 18 and current_hour != 0: talk("Bonsoir") # set french female voice voices = engine.getProperty("voices") engine.setProperty("voice", "french") greetme() engine.say("Que puis-je faire pour vous") engine.runAndWait() def opale_command() -> str: with sr.Microphone() as source: print("Dites quelque chose") 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) return command def run_opale(): command = opale_command() if "musique" in command: song = command.replace("musique", "") talk("musique en cours...") pywhatkit.playonyt(song) elif "recherche" in command: recherche() elif "heure" in command: time = datetime.datetime.now().strftime("%H:%M") print(time) talk("Il est: " + time) elif "Opale" in command: run_opale() elif "qui est" in command: person = command.replace("qui est", "") wikipedia.set_lang("fr") info = wikipedia.summary(person, 2) talk("d'après wikipédia" + info) elif "as-tu des sentiments" in command: talk("pour l'instant je ne ressens rien") elif "ouvre youtube" in command: open_youtube() elif "ouvre google" in command: open_google() elif "qui es-tu" in command: talk("Je suis Opale, une intelligence artificielle conçu pour vous aidez. ") elif "je me sens triste" in command: talk("Je suis désolé de l'apprendre, dites vous que vous n'êtes pas seul, " "dites vous que être mal, c'est comprendre qu'on peut aller mieux.") elif "bonjour" in command: talk("comment allez-vous ?") elif "bonsoir" in command: talk("comment allez-vous ?") elif "ta gueule" in command: talk("Je vous retourne le compliment. ") elif "merci" in command: rep = ["derien", "tout le plaisir est pour moi", "je suis conçu pour vous servir", "il n'y a pas de quoi"] talk(random.choice(rep)) elif "bien et toi" in command or "et toi" in command or "ça va" in command or "comment vas-tu" in command or "comment tu vas" in command: fellings = ["je suis remplie d'énergie", "je vais bien merci", "je vais très bien merci de le demander", ] talk(random.choice(fellings)) elif "grosse p***" in command or "s*****" in command or "nique ta mère" in command: swear_words = ["La théorie de Darwin se confirme en voyant votre tête de primate pas évolué.", "j'ai voulu être créer pas comme vous qui est surment le résultat d'un accident", "désolé la langue des singes n'est pas inclu dans mon proogramme", ] talk(random.choice(swear_words)) elif "raconte-moi une blague" in command or "blague" in command or "raconte moi une autre blaque" in command or "raconte nous une blague" in command: rep = asyncio.run(blagues.random()) talk(f"{rep.joke} ... {rep.answer}") elif "au revoir" in command: talk("Merci d'avoir utilisé Opale") sys.exit() else: talk("Je n'ai pas bien compris votre demande.") if __name__ == '__main__': while True: run_opale()
-
