need to run a python script from patch

Rick's icon

Hi all,

I've been running a patch that used the [shell] object to run a python script... for some reason this no longer works. I don't know if it is the updated operating system (osx10.13.1) or what... Does anyone have any advice on how to run this python script from max other than using the shell object? I can't even find a help file for the shell object online anymore.

Cheers!

Source Audio's icon

Here is shell help file from 2013.
It could be that osx 10.3 does not allow shell to execute.
Who knows.
It is allways a question what will not work after system update,
I wonder why people update their good running systems, maybe out of
curiosity ?
You could pack Your script into some executable form, and
launch that from max using launchbrowser message.
After turning off gate keeper, SIP protection, virus protection and I don't know what else
before one gets right to do stuff on own computer

shell.maxhelp.zip
application/zip 2.31 KB

Rick's icon

Thanks for the advice! I embedded the python script within an applescript and now the shell object can run it using the osascript command. Silly macs...
Cheers!

Source Audio's icon

That means that shell is not entirely broke on 10.13.
Maybe it is rather problem with shell - perl ?
Could You get any perl script to work ?
Or would perl at least output it's version ?
perl -version -> to shell, or perl -help ?

vichug's icon

hey Rick, could you provide us an example how you did (on earlier osx version...) to run python script from shell ? last time i tried, i think i didn't work my head around the right syntax format...

Rick's icon

message with:
perl -version
to [shell]
returns:
"This is perl 5, version 18, subversion 2......"

This seems to be working well.

Previously I just sent a message with:
python /location and name of python script
to [shell]

and it would run the python script.

after updating to 10.13.1 the python script only partially worked... it seemed to freeze up after the first action in the script. It didn't generate the textfile or audio file which it previously did.

It could definitely be some annoying permissions thing in osx.

Now I created an applescript that just reads:
do shell script "python /location of python script"

and I use shell to call the applescript with
osascript /location and name of applescript

This works!

The osascript call for shell isn't in the shell help file. I think I found it somewhere in the forums.

Source Audio's icon

Sorry, I did exchange perl for python, but anyway...
it all depends if You just want to execute some script from max,
or programm the script in max.
What You describe indicates that execution of the same script
differs if it was called from max via shell object, or via applescript.
You could avoid using shell with osascript by making applescript app
and launching it from max with ; max launchbrowser " file:///path to app"
for example :
; max launchbrowser "file:///Users/Mac/Desktop/Fan Speed.app"
Not that it is in any way better, but it could be more convenient in some cases.
If script needs admin rights, one could do that in applescript, like
do shell script "sudo mkdir ~/Desktop/AAA" password "haha" with administrator privileges
That would silently create folder AAA on Desktop with amin rights

vichug's icon

ty for info !

Source Audio's icon

You are welcome.
Did You try py external from Thomas Grill ?
https://grrrr.org/research/software/py/