Search code examples
pythonpython-3.xmoduleenvironment-variablespython-os

'say' is not recognized as an internal or external command, operable program or batch file


import os


def say(text):
    os.system(f"say {text}")


if __name__ == '__main__':
    print('PyCharm')
    say("Hello I am Jarvis A.I")

Error is

'say' is not recognized as an internal or external command, operable program or batch file.


Solution

  • The 'say' command is only on MacOS. I tried your code on my Mac and it works just fine. If you want similar functionality on Windows, you'll need to install a 3rd party command line tool and add it to your system PATH. Try this tool: https://github.com/p-groarke/wsay. You can then add it to your PATH and use os.system with the 'wsay' command instead