#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Running say command from script


    i have a script that will call the say command on my Mac and read a text file.

    In version 2.6 i used this code
    Code:
    import commands
    commands.getstatusoutput('/usr/bin/say -f info.txt')
    on version3.3.2 commands has been removed. So i tried using subprocess but haven't had any luck. Here is my code.
    Code:
    import subprocess
    subprocess.check_output("/usr/bin/say -f info.txt")
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,931
    Rep Power
    481

    Try it like this


    subprocess.check_output(('/usr/bin/say','-f','info.txt'))


    Otherwise you'd need to set shell=True, as in




    subprocess.check_output(('/usr/bin/say','-f','info.txt'))




    I'll need to install my speech server.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0
    That worked just like i needed. Thanks

IMN logo majestic logo threadwatch logo seochat tools logo