Subprocess not working on Mac M1

Hello, I need to port a project from Windows to MacOs (M1, BigSur). I succeed adapting Python libraries from W to M (pysftp need “hostkeys = None”, ffmpy changed to python-ffmpeg). Working in terminal but I cant use subprocess inside TD, no error but nothing works. Any idea what can block the process?
It works perfectly in Windows but not at all in MacOs :frowning:
here the python inside TD:

import subprocess
# search data in table
path = op('forEncode')[1, 'path']
target = str(path).split('.')
target = target[0] + '.mp4'
# add args tags
pat = "-p="+str(path)
tar = "-t="+str(target)
# list of args
my_args = [pat, tar]

# python script address
cmd_python_script = '/Users/lepetitstudiocine/Movies/MutationCinema/transcodeVideo.py'
#cmd_python_script = 'transcodeVideo.py'


# add args
command_list = ['python', cmd_python_script] + my_args

# create python subprocess
p=subprocess.Popen(command_list, shell = True)

# store the process ref
me.store('process', p)

Here is the external Python script


import ffmpeg
# sending feedback to TD
from pythonosc.udp_client import SimpleUDPClient
ip = "127.0.0.1"
port = 11001
client = SimpleUDPClient(ip, port)
client.send_message("/test", 200)
# import arguments from TD (commented here)
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('-p','--pat', default='/Volumes/MutCin/captures/21-11-20/20h.mov')
parser.add_argument('-t','--tar', default='/Volumes/MutCin/captures/21-11-20/20h.mp4')
args = parser.parse_args()
#pat = args.pat
#tar = args.tar
pat = '/Volumes/MutCin/captures/21-11-22/12h.mov'
tar = '/Volumes/MutCin/captures/21-11-22/12h.mp4'
client.send_message("/path", pat)
client.send_message("/target", tar)
# run ffmpeg
stream = ffmpeg.input(pat)
#stream = ffmpeg.hflip(stream)
stream = ffmpeg.output(stream, tar)
ffmpeg.run(stream)

Hello, I continue to work on my problem. I managed to use the right python app (thank you to Matthew Ragan) but now the problem is:
– pythonosc is working well in the subprocess (I receive the OSC)
– pysftp, ffmpy and ffmpeg are working well when run from terminal but not working at all inside subprocess. On Windows its working perfectly.
Any idea?

Hello, I am also having problems with running Python code externally (but from the same machine) in TD in Mac M1. After a few unsuccessful days trying to load libraries, I decided to use Subprocess. I am following @raganmd s instructions ‘Python and Subprocess Module’. The problem is similar to what @jacqueshoepffner mentioned previously. I don’t have any errors but nothing works. The code works well when I start it from the terminal.

Could you please explain a bit about the suggestion of Matthew Ragan related to this problem?

Here is the script in TD. I tried the script with the code provided in the tutorial. I am using UDPIn DAT but haven’t got any messages. The patch works in Windows without any issues.

import subprocess
 
# point to our script that we're going to execute
cmd_python_script = '/Users/fzayguler/Desktop/main-final.py'

python_exe = '/Users/fzayguler/opt/anaconda3/bin/python'
 
# print our script path - quick debug
print(cmd_python_script)
 
# clear the last entries from the UDPin DAT
op('udpin1').par.clear.pulse()
 
# call our script with subprocess

subprocess.Popen([python_exe, cmd_python_script], shell=True)