So almost 2 years later and still not sure if anything has been done to address this, but as I just started delving into an attempt at some Davinci scripting and ran into the 'aich ee double hockey sticks' of getting things to work enough to get started, here's what I (eventually) did (Windows 11, didn't try on Linux yet ... I wish they supported Linux better, a much faster platform, but DR loses some important functionality on Linux.)
It's not all that hard to do once you get past the confusion of 'python versions end of support' and claims of the Davinci APIs as to what python versions they 'require', so here's hopefully a concise (aka ignorance is bliss) way of getting this to work to the point you can start writing wonderful scripts.
BTW: do we have access to the transcription or captioning service through any of the APIs? Would be nice to make use of those services in Davinci ... better than paying for Amazon, Google, IBM, cloud services (some of them free but only for a limited number of hours per month.)
Anyway:
- Code: Select all
* Installed DR Studio
- Code: Select all
* Set up the preferences -> system -> general -> External scripting using 'local'
- Code: Select all
* Installed python 3.10.11 (didn't try 3.11 or 3.12 as I read somewhere it doesn't work. But who really knows?)
Enviroment vars (user)
- Code: Select all
PYTHONHOME = C:\Users\%USER%\AppData\Local\Programs\Python\Python310 (default install location for Python)
- Code: Select all
RESOLVE_SCRIPT_API = %PROGRAMDATA%\Blackmagic Design\DaVinci Resolve\Support\Developer\Scripting
- Code: Select all
RESOLVE_SCRIPT_LIB = C:\Program Files\Blackmagic Design\DaVinci Resolve\fusionscript.dll
- Code: Select all
PYTHONPATH = %PYTHONPATH%;%RESOLVE_SCRIPT_API%\Modules\
Installing python modules for Davinci Resolve (not 100% sure this is needed once you set the environment variables, at least for the 'davinci_resolve_api' module, I think if you want to use 'pydavinci' module then you will need to use pip to install, but I don't think it hurts either way ... someone can try a test import without 'pip install' of the modules and report back?)
- Code: Select all
pip install davinci_resolve_api --ignore-requires-version
pip install pydavinci --ignore-requires-version
Some quick test code to see if it's working:
(davinci_resolve_api) should create a new project in DR called 'Hello World"
- Code: Select all
import DaVinciResolveScript as dvr_script
resolve = dvr_script.scriptapp("Resolve")
fusion = resolve.Fusion()
projectManager = resolve.GetProjectManager()
projectManager.CreateProject("Hello World")
(pydavinci) should print out the name of the 'Hello World' project, which o course will be 'Hello World'!
- Code: Select all
resolve = davinci.Resolve()
project = resolve.project
project_manager = resolve.project_manager
media_pool = resolve.media_pool
media_storage = resolve.media_storage
print(project.name)