MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / invoke_command

Function invoke_command

scenedetect/platform.py:221–247  ·  view source on GitHub ↗

Same as calling Python's subprocess.call() method, but explicitly raises a different exception when the command length is too long. See https://github.com/Breakthrough/PySceneDetect/issues/164 for details. Arguments: args: List of strings to pass to subprocess.call(). Retu

(args: list[str])

Source from the content-addressed store, hash-verified

219
220
221def invoke_command(args: list[str]) -> int:
222 """Same as calling Python's subprocess.call() method, but explicitly
223 raises a different exception when the command length is too long.
224
225 See https://github.com/Breakthrough/PySceneDetect/issues/164 for details.
226
227 Arguments:
228 args: List of strings to pass to subprocess.call().
229
230 Returns:
231 Return code of command.
232
233 Raises:
234 CommandTooLong: `args` exceeds built in command line length limit on Windows.
235 """
236 try:
237 return subprocess.call(args)
238 except OSError as err:
239 if os.name != "nt":
240 raise
241 exception_string = str(err)
242 # Error 206: The filename or extension is too long
243 # Error 87: The parameter is incorrect
244 to_match = ("206", "87")
245 if any([x in exception_string for x in to_match]):
246 raise CommandTooLong() from err
247 raise
248
249
250def get_ffmpeg_path() -> str | None:

Callers 4

test_invoke_commandFunction · 0.90
test_long_commandFunction · 0.90
split_video_mkvmergeFunction · 0.90
split_video_ffmpegFunction · 0.90

Calls 1

CommandTooLongClass · 0.85

Tested by 2

test_invoke_commandFunction · 0.72
test_long_commandFunction · 0.72