NameError: name 'bmd' is not defined -- importing Python API

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Charles Duffy

  • Posts: 26
  • Joined: Mon Dec 28, 2020 12:13 pm
  • Real Name: Charles Duffy

NameError: name 'bmd' is not defined -- importing Python API

PostFri Jan 01, 2021 5:40 pm

Howdy --

I installed Python 3.6 (aside: it'd be nice to move to a language version for which Windows binaries are still being published with security updates), but am having trouble actually loading the API.

Pointers? (I'm using the paid/Studio version of the product, so as I understand it the Python API should be properly supported).

Code: Select all
C:\Users\Charles>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['RESOLVE_SCRIPT_LIB']
'F:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll'
>>> import imp
>>> imp.load_dynamic('fusionscript', os.environ['RESOLVE_SCRIPT_LIB'])
Traceback (most recent call last):
  File "<string>", line 173, in <module>
NameError: name 'bmd' is not defined
<module 'fusionscript' (F:\Program Files\Blackmagic Design\DaVinci Resolve\fusionscript.dll)>
>>> fusionscript = _
>>> help(fusionscript)
Traceback (most recent call last):
  File "F:\Program Files\Python36\lib\tokenize.py", line 390, in find_cookie
    line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\Program Files\Python36\lib\_sitebuiltins.py", line 103, in __call__
    return pydoc.help(*args, **kwds)
  File "F:\Program Files\Python36\lib\pydoc.py", line 1857, in __call__
    self.help(request)
  File "F:\Program Files\Python36\lib\pydoc.py", line 1916, in help
    else: doc(request, 'Help on %s:', output=self._output)
  File "F:\Program Files\Python36\lib\pydoc.py", line 1643, in doc
    pager(render_doc(thing, title, forceload))
  File "F:\Program Files\Python36\lib\pydoc.py", line 1636, in render_doc
    return title % desc + '\n\n' + renderer.document(object, name)
  File "F:\Program Files\Python36\lib\pydoc.py", line 382, in document
    if inspect.ismodule(object): return self.docmodule(*args)
  File "F:\Program Files\Python36\lib\pydoc.py", line 1100, in docmodule
    synop, desc = splitdoc(getdoc(object))
  File "F:\Program Files\Python36\lib\pydoc.py", line 91, in getdoc
    result = inspect.getdoc(object) or inspect.getcomments(object)
  File "F:\Program Files\Python36\lib\inspect.py", line 839, in getcomments
    lines, lnum = findsource(object)
  File "F:\Program Files\Python36\lib\inspect.py", line 782, in findsource
    lines = linecache.getlines(file, module.__dict__)
  File "F:\Program Files\Python36\lib\linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "F:\Program Files\Python36\lib\linecache.py", line 136, in updatecache
    with tokenize.open(fullname) as fp:
  File "F:\Program Files\Python36\lib\tokenize.py", line 454, in open
    encoding, lines = detect_encoding(buffer.readline)
  File "F:\Program Files\Python36\lib\tokenize.py", line 431, in detect_encoding
    encoding = find_cookie(first)
  File "F:\Program Files\Python36\lib\tokenize.py", line 395, in find_cookie
    raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for 'F:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll'
>>>

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot], Yahoo [Bot] and 319 guests