0

I installed espeak with homebrew.

Using the which espeak command in my terminal, I got this path : '/Users/username/homebrew/bin/espeak'

I added it to my path in python :

import os 
os.environ['PATH'] += ':/Users/username/homebrew/bin/espeak'

I then called eSpeak with subprocess

from subprocess import call
call(["espeak", "-v", "mb-us1", "Hello, I am espeak"]) 

But I get this error :

Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
NotADirectoryError                        Traceback (most recent call last)
Cell In[14], line 3
      1 from subprocess import call
----> 3 call(["espeak", "-v", "mb-us1", "Hello, I am espeak"]) 

File /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py:349, in call(timeout, *popenargs, **kwargs)
    341 def call(*popenargs, timeout=None, **kwargs):
    342     """Run command with arguments.  Wait for command to complete or
    343     timeout, then return the returncode attribute.
    344 
   (...)
    347     retcode = call(["ls", "-l"])
    348     """
--> 349     with Popen(*popenargs, **kwargs) as p:
    350         try:
    351             return p.wait(timeout=timeout)

File /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py:951, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    947         if self.text_mode:
    948             self.stderr = io.TextIOWrapper(self.stderr,
    949                     encoding=encoding, errors=errors)
--> 951     self._execute_child(args, executable, preexec_fn, close_fds,
    952                         pass_fds, cwd, env,
    953                         startupinfo, creationflags, shell,
...
   1820         err_msg = os.strerror(errno_num)
-> 1821     raise child_exception_type(errno_num, err_msg, err_filename)
   1822 raise child_exception_type(err_msg)

NotADirectoryError: [Errno 20] Not a directory: 'espeak'

In the end, I need this to work in order to use the pyttsx3 packages to save audio as mp3 from text.

Any ideas how I can solve this ?

Gabriel

0 Answers0