-2

So I've imported flask into my project to support pywhatkit as it wouldn't work without it and I'm now getting this error:

Exception ignored on calling ctypes callback function: <function catch_errors.<locals>.call_with_this at 0x000001F911A1B130>
Traceback (most recent call last):
  File "C:\Users\ironm\PycharmProjects\Nexus\venv\lib\site-packages\comtypes\_comobject.py", line 91, in call_with_this
  File "C:\Users\ironm\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1496, in error
  File "C:\Users\ironm\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1725, in isEnabledFor
TypeError: 'NoneType' object is not callable

I'm not sure what's going on here but I was hoping someone would be able to tell me what's up. Although I don't think it's at fault here is my code incase:

import speech_recognition as sr
import pyttsx3
from flask import Flask
import pywhatkit

import settings as settingsData

global shutdown
shutdown= False

listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[settingsData.voice].id)
engine.setProperty("volume", settingsData.volume)
engine.setProperty("rate", settingsData.rate)

def Talk(text):
    print(text)
    engine.say(text)
    engine.runAndWait()

def Listen():
    try:
        with sr.Microphone() as source:
            print("Listening...")
            voice = listener.listen(source)
            command = listener.recognize_google(voice)
            command = command.lower()
            command = " " + command
            if " nexus" in command:
                command = command.replace(" nexus", "")
                print("Command: " + command)
                return command
            else:
                return ""
    except:
        return ""
        pass

def RunNexus():
    command = Listen()
    if " say" in command:
        command = command.replace(" say", "")
        Talk(command)
    elif " se" in command:
        command = command.replace(" se", "")
        Talk(command)
    elif " shutdown" in command:
        global  shutdown
        Talk("Shutting down...")
        shutdown = True


while shutdown == False:
    RunNexus()

Thanks for any help!

1 Answers1

0

the solution I found for this problem is to download the version of pywhatkit, for me, it worked with version 5.0.

Wasi Master
  • 1,112
  • 2
  • 11
  • 22
Dromel
  • 1