Executing python scripts from a patcher

jon snow's icon

jon snow

11月 15 2023 | 8:09 午後

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

Source Audio

11月 16 2023 | 7:27 午前

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

pdelges's icon

pdelges

11月 16 2023 | 7:44 午前

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

jon snow

11月 20 2023 | 4:17 午後

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"