This is the code:

import pyttsx3, PyPDF2

pdfreader = PyPDF2.PdfReader(open('D2DStuff.pdf', 'rb'))
speaker = pyttsx3.init()
clean_text = ''

for p_num in range(len(pdfreader.pages)): 
    text = pdfreader.pages[p_num].extract_text()
    clean_text += text.strip().replace('n', ' ')
    print(clean_text)

speaker.save_to_file(clean_text, 'd2d.mp3')
speaker.runAndWait()

speaker.stop()

This is the error after installing py3-tts:

(.venv) baguma@Bagumas-MacBook-Pro py2 % /Users/baguma/Desktop/py2/.venv/bin/python /Us
ers/baguma/Desktop/py2/main.py
Traceback (most recent call last):
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/pyttsx3/__init__.py", line 24, in init
    eng = _activeEngines[driverName]
          ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/weakref.py", line 136, in __getitem__
    o = self.data[key]()
        ~~~~~~~~~^^^^^
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/pyttsx3/__init__.py", line 27, in init
    eng = Engine(driverName=driverName, debug=debug)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/pyttsx3/engine.py", line 32, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/pyttsx3/driver.py", line 51, in __init__
    self._module = importlib.import_module(name)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 2, in <module>
    from AppKit import NSSpeechSynthesizer
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/AppKit/__init__.py", line 10, in <module>
    import Foundation
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/Foundation/__init__.py", line 9, in <module>
    import CoreFoundation
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/CoreFoundation/__init__.py", line 9, in <module>
    import objc
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/objc/__init__.py", line 40, in <module>
    from ._bridgesupport import *  # noqa: F401, F403, E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/objc/_bridgesupport.py", line 15, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/baguma/Desktop/py2/main.py", line 4, in <module>
    speaker = pyttsx3.init()
              ^^^^^^^^^^^^^^
  File "/Users/baguma/Desktop/py2/.venv/lib/python3.12/site-packages/pyttsx3/__init__.py", line 29, in init
    raise ValueError("nnDriver '%s' is unavailable" % driverName)
ValueError: 

Driver 'None' is unavailable

Has anyone encountered this before? How to solve?

////////////////////////////////////////…………………………………………………………………………………………………………………………………………