0

I want to install the python-praat-scripts package. It says:

Installation

You can install python-praat-scripts through pip via:

pip install python-praat-scripts

Or through downloading this repository and running:

python setup.py install

Once installed, the praatinterface package will be importable.

So I did that. Then it says:

For basic usage, instantiate a PraatLoader object as below:

``` from praatinterface import PraatLoader

pl = PraatLoader(praatpath = '/path/to/praat')

text = pl.run_script('formants.praat', '/path/to/wav/file', 5, 5500)

formants = pl.read_praat_out(text) ```

So I wrote the following:

from praatinterface import PraatLoader

praat_path = '/usr/bin/praat'
pl = PraatLoader(praatpath = praat_path)
for path in ae_paths:
    text = pl.run_script('formants.praat', path, 5, 5500)
    formants = pl.read_praat_out(text)
    print(formants)

here ae_paths is a list with audio paths. The praat path was found by writing in the terminal:

vladimir@vladimir:/usr/bin$ type praat

praat is /usr/bin/praat

However I get an error:

--------------------------------------------------------------------------- PermissionError Traceback (most recent call last) in () 2 3 praat_path = '/usr/bin/praat' ----> 4 pl = PraatLoader(praatpath = praat_path) 5 for path in ae_paths: 6 text = pl.run_script('formants.praat', path, 5, 5500)

/home/vladimir/anaconda3/lib/python3.5/site-packages/praatinterface/Praat.py in init(self, **kwargs) 18 self.script_dir = os.path.join(os.path.dirname(file),'praatScripts') 19 self.praat = 'praat' ---> 20 self.init_scripts() 21 if self.debug: 22 self.initlog()

/home/vladimir/anaconda3/lib/python3.5/site-packages/praatinterface/Praat.py in init_scripts(self) 35 def init_scripts(self): 36 if not os.path.isdir(self.script_dir): ---> 37 os.mkdir(self.script_dir) 38 for s in self.scripts: 39 sfilename = s

PermissionError: [Errno 13] Permission denied: '/usr/bin/praatScripts'

Vladimir Vargas
  • 1,744
  • 4
  • 24
  • 48
  • For some reason, the Python wrapper around praat is trying to create a praatScripts directory if it's not there, right next to the /usr/bin/praat executable. Of course, that requires root permission. But overall, it simply should not do this; it's just bad practice. I'm inclined to say: avoid this package. –  Nov 10 '16 at 00:05
  • Alternatively, you could try and create virtualenv and work in that, since that environment will be owned by you. But it's a work-around, not a real solution to the problem. –  Nov 10 '16 at 00:07
  • 1
    Perhaps you can take up this issue with the author, and ask what their actual intention is. But it feels very un-system like to have a directory /usr/bin/praatScripts/ . –  Nov 10 '16 at 00:11
  • @Evert Trying [this](http://homepage.univie.ac.at/christian.herbst//python/#topOfPage) but still getting other kind of errors. – Vladimir Vargas Nov 10 '16 at 01:02
  • "other kind of errors" is obviously a different (new) question. –  Nov 10 '16 at 01:46
  • You also point to a completely other example, without mentioning if you already solved your actual problem stated here. (Besides, "this" is a rather generic pointer to a page with a dozen code samples. You'll want to ask a new question then, detailing what you attempt to do and what the error is, as you've done here.) –  Nov 10 '16 at 01:50

1 Answers1

0

I have another way to run praat scripts. you can try this way.

First you have to install praat to run python praat scripts - you can install praat using this "sudo apt-get install praat"

  • after that open praat GUI using "./praat" command in CMD.
  • there is option run to praat scripts. click on it and select your praat script and execute.
Arif Rathod
  • 578
  • 2
  • 13