[Solved] Python cannot connect to resolve - resolve = None

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

AustinWitherspoon

  • Posts: 17
  • Joined: Tue Nov 17, 2020 3:36 am
  • Real Name: Austin Witherspoon

[Solved] Python cannot connect to resolve - resolve = None

PostTue Apr 20, 2021 4:46 pm

Resolve 17.1 Studio, 'External Scripting using' set to Network. Python 2.7

I have two computers with the same version of windows, and the same version of Resolve on them. One will let me run the following python code and it will connect to the resolve API totally fine:

Code: Select all
import imp
lib = "C:\\Program Files\\Blackmagic Design\\Davinci Resolve\\fusionscript.dll"
dvr_script = imp.load_dynamic("fusionscript", lib)
resolve = dvr_script.scriptapp("Resolve")

The other computer totally fails:
print(dvr_script) outputs
Code: Select all
<module 'fusionscript' from 'C:\Program Files\Blackmagic Design\Davinci Resolve\fusionscript.dll'>
and print(resolve) outputs
Code: Select all
None


So it's finding the fusion script dll file and importing it, but not able to access resolve for some reason?

Running the same script on a different computer connects totally fine. I've had this issue in the past multiple times as well. Every time, it's been at a VFX company (multiple companies) on a workstation - not sure if that has anything to do with it?

What sort of environment settings could prevent the above code from connecting to resolve? Unfortunately, I can't run the code from inside of resolve, I have to externally for the job I'm trying to do.
Last edited by AustinWitherspoon on Mon Apr 26, 2021 8:46 pm, edited 1 time in total.
Offline
User avatar

Igor Riđanović

  • Posts: 1601
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: Python cannot connect to resolve - resolve = None

PostTue Apr 20, 2021 9:47 pm

I have seen this on occasion where there had been a Resolve installed prior to Resolve Studio. As if the Resolve Studio installer didn't overwrite the API library. But, that was on macOS.

Which version of Python do you have on the machine that fails?
www.metafide.com - DaVinci Resolve™ Apps
Offline

AustinWitherspoon

  • Posts: 17
  • Joined: Tue Nov 17, 2020 3:36 am
  • Real Name: Austin Witherspoon

Re: Python cannot connect to resolve - resolve = None

PostTue Apr 20, 2021 10:10 pm

Python 2.7.14 64bit. Odd thing in this case is that it worked perfectly last week, but this week started having issues - I.T. people can't think of anything that's changed or been deployed though.

I'm curious if anybody knows which environment settings matter for it to connect? Is there any firewall stuff that could possibly affect it? Any import ports that need to be unused for fusionscript.dll to connect to resolve, or anything like that?

Thanks igor, I can try copying the fusionscript.dll from another functioning computer perhaps.

Edit: No luck on using another fusionscript.dll unfortunately.
Offline

AustinWitherspoon

  • Posts: 17
  • Joined: Tue Nov 17, 2020 3:36 am
  • Real Name: Austin Witherspoon

Re: Python cannot connect to resolve - resolve = None

PostSat Apr 24, 2021 12:11 am

So another development- still doesn't work, but more is broken here than just importing the resolve api.

I did a test script with just
Code: Select all
print('This code works.')
and placed it in C:\ProgramData\Blackmagic Design\DaVinci Resolve\Fusion\Scripts\Edit\ so it would pop up in my scripts menu in resolve. This way, I could bypass all of the nonsense that wasn't working with attempting to use fuscript to connect to resolve.

Interestingly, this also fails when run from the resolve menu. I have one computer that works properly that will run this test script and if I open the console in resolve it says This code works. as expected, but if I run it the same exact way on the other computer, nothing pops up.

So whatever is causing this issue isn't anything to do with the fuscript issue before, since it fails when resolve runs it internally as well. I can manually type in python in the console and it executes fine, but anything in the resolve scripts folder won't run.
Offline
User avatar

iddos-l

  • Posts: 799
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Python cannot connect to resolve - resolve = None

PostSat Apr 24, 2021 4:43 am

The scripts from the drop down menu will go through the environment variables to find and load the fuscpript where the code inside the console does not. (It only needs the python PATH)
So this looks like an environment issue to me.
I would double check the configuration between the two machines


Sent from my iPhone using Tapatalk
Offline
User avatar

Andrew Hazelden

  • Posts: 538
  • Joined: Sat Dec 06, 2014 12:10 pm
  • Location: West Dover, Nova Scotia, Canada

Re: Python cannot connect to resolve - resolve = None

PostSun Apr 25, 2021 8:38 pm

Hi. By chance do you have either a Synology NAS, or VS Code with the Tabnine plugin active? Both of those situations are known to sit on the same port numbers as Fusion’s Fuscript interapplication process does.
Mac Studio M2 Ultra / Threadripper 3990X | Fusion Studio 18.6.4 | Kartaverse 6
Offline

AustinWitherspoon

  • Posts: 17
  • Joined: Tue Nov 17, 2020 3:36 am
  • Real Name: Austin Witherspoon

Re: Python cannot connect to resolve - resolve = None

PostMon Apr 26, 2021 8:45 pm

Andrew Hazelden wrote:Hi. By chance do you have either a Synology NAS, or VS Code with the Tabnine plugin active? Both of those situations are known to sit on the same port numbers as Fusion’s Fuscript interapplication process does.



My god! This was it! Using TabNine in VSCode. I didn't realize resolve was doing network stuff when used locally. Conflicting port numbers makes sense!

Thank you so much - I have spent so many days comparing environment variables between machines trying to figure out what was going on.
Offline
User avatar

Igor Riđanović

  • Posts: 1601
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: [Solved] Python cannot connect to resolve - resolve = No

PostTue Apr 27, 2021 6:51 pm

Thanks Andrew. That's good to know.
www.metafide.com - DaVinci Resolve™ Apps
Offline

relentlessplay

  • Posts: 1
  • Joined: Wed Jul 20, 2022 2:08 am
  • Real Name: Thomas Hollier

Re: [Solved] Python cannot connect to resolve - resolve = No

PostWed Jul 20, 2022 2:10 am

Hi there,

I am having the same problem as well. Any chance you can tell me how I can figure out if I have this tabnine plugin installed or not? Also, what is the number of the port so I may see if anything else is using it.
Thx.

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], panos_mts, Uli Plank and 175 guests