Error using pyttsx3 is a text-to-speech conversion library in Python

pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.

import pyttsx3
engine = pyttsx3.init()

It shows errors:

Traceback (most recent call last):
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
    eng = _activeEngines[driverName]
  File "C:\Users\MyName\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, in __getitem__
    o = self.data[key]()
KeyError: None

During handling of the above exception, another exception occurred:
...

If running into this type of error for this pip library, you can uninstall the current version and downgrade the library, using these commands:

pip uninstall pyttsx3
pip install pyttsx3==2.71

You’ll see this notification in the console:

Collecting pyttsx3==2.71
  Downloading pyttsx3-2.71-py3-none-any.whl (39 kB)
Requirement already satisfied: pypiwin32; "win32" in sys_platform in c:\users\MyName
\appdata\local\programs\python\python38-32\lib\site-packages (from pyttsx3==2.
71) (223)
Requirement already satisfied: pywin32>=223 in c:\users\MyName\appdata\local\progr
ams\python\python38-32\lib\site-packages (from pypiwin32; "win32" in sys_platfor
m->pyttsx3==2.71) (228)
Installing collected packages: pyttsx3
Successfully installed pyttsx3-2.71

Then try running this example again:

import pyttsx3
engine = pyttsx3.init()
engine.say("Hello, I'm fixed.")
engine.runAndWait()

How to send email to SMS or MMS

Each phone carrier has its own hostname. To send a text message via email, you’ll need to use a SMS or MMS to SMTP Outgoing email gateway. Just substitute a 10-digit cell number for ‘number’ for each carrier below:

AT&T: number@txt.att.net (SMS), number@mms.att.net (MMS)
T-Mobile: number@tmomail.net (SMS & MMS)
Verizon: number@vtext.com (SMS), number@vzwpix.com (MMS)
Sprint: number@messaging.sprintpcs.com (SMS), number@pm.sprint.com (MMS)
XFinity Mobile: number@vtext.com (SMS), number@mypixmessages.com (MMS)
Virgin Mobile: number@vmobl.com (SMS), number@vmpix.com (MMS)
Tracfone: number@mmst5.tracfone.com (MMS)
Metro PCS: number@mymetropcs.com (SMS & MMS)
Boost Mobile: number@sms.myboostmobile.com (SMS), number@myboostmobile.com (MMS)
Cricket: number@sms.cricketwireless.net (SMS), number@mms.cricketwireless.net (MMS)
Republic Wireless: number@text.republicwireless.com (SMS)
Google Fi (Project Fi): number@msg.fi.google.com (SMS & MMS)
U.S. Cellular: number@email.uscc.net (SMS), number@mms.uscc.net (MMS)
Ting: number@message.ting.com
Consumer Cellular: number@mailmymobile.net
C-Spire: number@cspire1.com
Page Plus: number@vtext.com

Get multiple records in MySQL Database by number of occurrences

If you have problem remembering all abbreviations of U.S. States, use the query below to get data from MySQL Database. In MySQL DB, you must have a state table that include id, state_full_name, state_abbreviation and all records. You must have a table of all users containing some records. The example below are from my own DB, the names of the 2 tables are tblstates and tbluserdetails.

select s.State_name, c.state_name,
count(c.state_name) as NumberOccurrences
from tblstates s, tbluserdetails c
where s.State_Abrv = c.state_name
group by c.state_name
having ( count(c.state_name) > 1 );

The screenshot below is the results from the query above.

Get multiple records in MySQL Database by number of occurrences