ImportError No system module pywintypes pywintypes38 dll

0 votes
import datetime

import speech_recognition as sr

import pyttsx3

import wikipedia

import webbrowser

import os


engine=pyttsx3.init('sapi5')

voices=engine.getProperty('voices')

engine.setProperty('voice',voices[1].id)

engine.setProperty('rate', 150)

print(type(engine))

print(engine)


def speak(audio): #to speak. Text to Speech

    engine.say(audio)

    engine.runAndWait()

def wishMe():

    hour=int(datetime.datetime.now().hour)

    # minute= int(datetime.datetime.now().minute)

    if (hour>=0 and hour<12):

        speak("Good Morning Boss!")     #Text to Speech

    elif(hour>=12 and hour<18):

        speak("Good Afternoon Boss")

    else:

        speak("Good Evening Boss")

    speak("I am Your Virtual Assistant, How may I help you?")


def takeCommand(): #it takes microphone input from the user and return the string output

     r=sr.Recognizer()    #recogniser class helps in recognising the audio

     with sr.Microphone() as source:

         print("Listening...")

         r.pause_threshold = 0.5 #it refers to the amount of time gap after which the audio is supposed to be complete

         r.energy_threshold =300

         audio=r.listen(source) #digitaldata of whatsoever hs been spoken will be stored in audio

     try:

      print("Recognising...")

      query=r.recognize_google(audio,language="en-in")

      print("User Said:",query)

     except Exception as e:

      print("Say that again please!")

      return "None"

     return query

wishMe()

#while True:

if 1:

    query = takeCommand().lower()

    #logic for executing tasks based on query

    if 'wikipedia' in query:   #wikipedia is a keyword. If user doesnt say that, it will not work.

        speak("Searching Wikipedia")

        query=query.replace("wikipedia", "")

        results=wikipedia.summary(query, sentences=2)

        speak("According to Wikipedia")

        print(results)

        speak(results)

    elif 'youtube' in query:

        webbrowser.open("youtube.com")

    elif 'facebook' in query:

        webbrowser.open("fb.com")

    elif 'stack overflow' in query:

        webbrowser.open("stackoverflow.com")

    elif 'google' in query:

        query=query.replace("google","")

        query=query.replace("search","")

        webbrowser.open("https://google.com/search?q=%s" % query)

    elif (('music' in query) or ("song" in query)):

         # music_dir = "G:\\Song"

        #music_dir= 'D:\\OldSongs' #\\ slash is to escape the character

        music_dir = 'D:\volume E\MUSIC 3.O\BOLLYWOOD'

        songs=os.listdir(music_dir)  #listdir is used to enlist all the songs of mentioned directory

        #print(songs)

        os.startfile(os.path.join(music_dir,songs[0])) #song[0] will play the first song. using random module, song can be shuffled

    elif 'time' in query:

        time=datetime.datetime.now().strftime("%H:%M")

        speak("Sir, the time is")

        speak(time)

    elif 'sleep' in query:

        exit()
Nov 25, 2020 in Python by Edureka
• 120 points
5,473 views

2 answers to this question.

0 votes

Hi, @Edureka

Try to uninstall your pyttsx3 module from your system and again reinstall it using the below command.

$ pip install pyttsx3

If you will get the same error, then try to install the below module.

$ pip install pypiwin32
answered Nov 25, 2020 by Gitika
• 65,770 points
0 votes

I just copied the DLL pywintypes27.dll in C:\Python27\Lib\site-packages\pywin32_system32.
I added it in win32/lib.

answered Nov 25, 2020 by Roshni
• 10,480 points

Related Questions In Python

0 votes
1 answer

ImportError: No module named requests

Requests is not available for use by ...READ MORE

answered Jun 26, 2018 in Python by Hamartia's Mask
• 1,580 points
2,550 views
+3 votes
1 answer

Tensorflow 1.5 ImportError: No module named tensorflow.python.client

I think it's a bug in Tensorflow ...READ MORE

answered Sep 25, 2018 in Python by charlie_brown
• 7,720 points
6,967 views
0 votes
1 answer

tensorflow 1.5 ImportError: No module named tensorflow.python.client

Some of the modules have changed in ...READ MORE

answered Oct 5, 2018 in Python by Priyaj
• 58,020 points
2,788 views
0 votes
1 answer

Python error "ImportError: No module named pygame.locals"

You need to download and install the ...READ MORE

answered Jun 18, 2019 in Python by Greg
7,037 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,467 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,127 views
0 votes
3 answers

import NumPy as np ImportError: No module named NumPy

You need to install numpy using pip install ...READ MORE

answered Dec 16, 2020 in Python by Roshni
• 10,480 points
35,726 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP