Search for a specific string in a file, print the index

I solved the problem by finding the path for python. The following works:

(
~get_sylabs = {|text|
	format(
		"/Users/prko/opt/anaconda3/bin/python.app -c \"import pyphen; out = pyphen.Pyphen(left=1, right=1, lang='it_IT').inserted('%'); print(out)\"",
		text
	).unixCmdGetStdOut.split($-)
}
)

x = ~get_sylabs.("Esempio, questa Stringa").do(_.postln)
x

Using ```.runInTerminal`` is ineffective because you cannot assign the result to a variable. Assigning a result to a variable is important for reusing the data.

1 Like

aaaa genius!!! you’re right, correcting the path works. Thanks for figuring this out!

@Robin_Morabito
I have found the reason. Please refer to: