Trying to use Xojo and Python to control DaVinci Resolve

Hi, I’m trying to use Xojo to control Blackmagic DaVinci Resolve via python3.

Python3 is working and running. Using it either in terminal with python3 Myscript.py or via interactive mode with one line at the time.

Trying to run this example script:
#!/usr/bin/env python
import DaVinciResolveScript as dvr_script
resolve = dvr_script.scriptapp(“Resolve”)
fusion = resolve.Fusion()
projectManager = resolve.GetProjectManager()
projectManager.CreateProject(“Hello World”)

in a myScript.py file, in terminal works fine. Running it in Xojo via Shell, gives me lot of problems…

I have added the full path /user/local/bin/python3 to the command and then the full path to the script but still I only get Error code 1 and no action in resolve.

I also have info about these:
RESOLVE_SCRIPT_API=“/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting”
RESOLVE_SCRIPT_LIB=“/Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so”
PYTHONPATH=“$PYTHONPATH:$RESOLVE_SCRIPT_API/Modules/”

What is the best approach here. Any starting tips welcome :slight_smile:

Would this be best done in shell in interactive mode ?
the import in the script does this need the full path as well ?

How do I set path for the shell to use ?

I modified your script to include the path for the lib.
Now it works for me in synchronous mode.

import sys
sys.path.append("/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules")

import DaVinciResolveScript as dvr_script
resolve = dvr_script.scriptapp("Resolve")
projectManager = resolve.GetProjectManager()
projectManager.CreateProject("Hello World")

Supert Ojan, I got it to work here as well.

No my last problem is how on earth to let this pass through Mac App Store… I get error 2 right away. When it is sandboxed. For web-site delivery with only hardened ON and no Sandboxing, the final app works fine…

I guess this is due to making calls using python3 that is not insde the app it self ?

I recall that calling shell from xojo excludes you from the app store…
you must call your python app from a plugin in xojo that is signed and notarized