Python Popen shell = False calls OSError: [Errno 2] There is no such file or directory

I am trying to run the Popen command below on OSX using shell = False:

command = "/usr/local/itms/share/iTMSTransporter.woa/iTMSTransporter -m verify -f /Volumes/Stuff/Temp/TMP_S_0_V_TV2.itmsp -u username -p password -o /Volumes/Stuff/Temp/TMP_S_0_V_TV2.itmsp/LOGFILE.txt -s provider -v eXtreme" self.process1 = Popen(command, shell=False, stdin=PIPE) 

But I get this error:

  raise child_exception OSError: [Errno 2] No such file or directory 

What is going wrong? I also need this to work on Windows, I know the directory paths, slashes, etc.

+6
source share
1 answer

The first argument to Popen should be a list of arguments. Otherwise, you tell him to find the executable named strange. You can use shlex.split() to properly split

like Popen(shlex.split(command), shell=False, stdin=PIPE)

next reading: Documents around the world

+11
source

Source: https://habr.com/ru/post/969649/


All Articles