Executing python scripts from a patcher

jon snow's icon

Hello everyone
I need some support making a patch that could launch python scripts.

I am using the "shell" object by jeremybernstein (https://github.com/jeremybernstein/shell) but I can't make it change directory.

The "cd" command seems not to work, as the working directory doesn't change.

Anyway, if I move the scripts in the working folder, it still doesn't work.
A sample command like "python3 /Users/username/hello.py", for instance.

Has anyone experienced such a thing?

Thank you

Source Audio's icon

either enter absolute path to pyhon in slash format,
or try wd attribute in shell (working directory)

pdelges's icon

With a script called "ws2sc.py" in the same folder as the Max patch, the following patch works for me:

Max Patch
Copy patch and select New From Clipboard in Max.


jon snow's icon

Ok, now I can run the python snippet, but what if there are some arguments to pass through?
The command should be like "code.py --file_name hello --duration 2"