Trying to get a tracking script to run in the background

am working on getting a tracking script to run in the background from an external terminal. So far I have been able to get it to work from the blender terminal, but when I try to run the script and blender in the background from my Macs terminal I get returned this error:

RuntimeError: Operator bpy.ops.clip.detect_features.poll() failed, context is incorrect

The script works inside the blender terminal properly and is:

import bpy
for area in bpy.context.screen.areas:
if area.type == ‘CLIP_EDITOR’:
override = bpy.context.copy()
override[‘area’] = area
bpy.ops.clip.detect_features(override)
break

Im wondering how I can go about fixing this error I get when running from my terminal, or how to go about solving this context issue.

If this is unclear let me know and I will try to clear it up.