Script does not run from menu Workspace > Comp

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Lookin

  • Posts: 5
  • Joined: Tue May 16, 2023 7:38 pm
  • Real Name: Oleg Данильченко

Script does not run from menu Workspace > Comp

PostTue May 16, 2023 7:49 pm

please help me to find the cause of the problem. The essence of the problem is that my lua script is executed directly from the console in Davinci. But there is absolutely no sign of working when I launch it from the Workspace>Comp menu.
Offline

Peter Chamberlain

Blackmagic Design

  • Posts: 13875
  • Joined: Wed Aug 22, 2012 7:08 am

Re: Script does not run from menu Workspace > Comp

PostWed May 17, 2023 1:36 am

If running a script externally you need the Studio version.
DaVinci Resolve Product Manager
Offline

Lookin

  • Posts: 5
  • Joined: Tue May 16, 2023 7:38 pm
  • Real Name: Oleg Данильченко

Re: Script does not run from menu Workspace > Comp

PostWed May 17, 2023 7:47 am

Peter Chamberlain wrote:If running a script externally you need the Studio version.

Thank you for your reply,) That's the thing, it happens inside Davinci environment
Offline

Lookin

  • Posts: 5
  • Joined: Tue May 16, 2023 7:38 pm
  • Real Name: Oleg Данильченко

Re: Script does not run from menu Workspace > Comp

PostWed May 17, 2023 11:15 am

I also noticed one more thing. If you open Davinci from the /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/MacOS folder and then run the lua script via the Workspace > Comp menu, then all the debugging information that is output by the "print" statement does not appear in the console inside the Davinci program, but in the terminal window from which Davinci was launched. In this case, the script line resolve = Resolve() returns nill. That is, it turns out that the lua interpreter inside Davinci does not have access to the API. But why, After all, the lua module is built into the program itself and must know where fusionscript.so lies? Or I'm wrong?
Offline

Lookin

  • Posts: 5
  • Joined: Tue May 16, 2023 7:38 pm
  • Real Name: Oleg Данильченко

Re: Script does not run from menu Workspace > Comp

PostWed May 17, 2023 2:30 pm

I decided to try running the Python script, and I encountered a problem as well, which I'm describing here.

As I mentioned earlier, I have Davinci Resolve Studio version. First, I took all the preparatory steps.

1. In the program settings I enabled the option for external script execution by selecting "Local" option.

-------------------------------------------------------------------------------------------
Image
-------------------------------------------------------------------------------------------

2. I added the environment variables mentioned in the API Introduction on the website
https://resolvedevdoc.readthedocs.io/en/latest/API_intro.html to the bash_profile file.

-------------------------------------------------------------------------------------------
Image
-------------------------------------------------------------------------------------------

3.Then I restarted the terminal and checked the state of the variables using the command "printenv".

Image

4. Then I restarted Davinci.

5. After that, I opened the terminal in the system utilities and navigated to the folder with the installed scripts. I made some edits to the python_get_resolve.py module, adding debug lines with the print statement.

Image

6. By selecting and running one of the scripts named 5_get_project_information.py, I received the following debug lines.

--------------------------------------------------------------------------------------------
Image
--------------------------------------------------------------------------------------------

My observations: As you can notice, after printing the result on the screen with the line "print("bmd_module is:", bmd)", the script hangs, although it should immediately output the second debug line with the connected API or simply "nill".
Based on the debug information, I conclude that the fusionscript.so module is found, but it cannot be executed.
What could be the problem?
Offline

Shrinivas Ramani

Blackmagic Design

  • Posts: 2714
  • Joined: Wed Sep 20, 2017 10:19 am

Re: Script does not run from menu Workspace > Comp

PostThu May 18, 2023 9:32 am

Oleg

If you're running a script from the Console, you do not need to initialise the resolve fusion and bmd variables. They're already present and you can start using them.

You need to initialise these variables only when running a script from terminal.

Hope that helps
Shrinivas
Offline

Lookin

  • Posts: 5
  • Joined: Tue May 16, 2023 7:38 pm
  • Real Name: Oleg Данильченко

Re: Script does not run from menu Workspace > Comp

PostThu May 18, 2023 1:30 pm

Thank you very much for your response, Shrinivas.
I may have caused some confusion with my previous message. In the last case, I was trying to run a Python script from the terminal. I switched to the terminal because I could see the debug information there.

The lines of code you mentioned were my modifications to the standard module python_get_resolve.py (which comes with the Davinci installation package).
Image
I added debug lines to understand if everything was being imported correctly. It turned out that the module was able to find the fusionscript.so library, but it hangs at the step where it should connect to it from the terminal.
------------------------------------------------------------------------------------------
Before that, I was running LUA scripts within Davinci, and for some reason, no debug information was being displayed openly in the console when running the script from the Workspace menu (which is inside Davinci, where you can see and run loaded scripts).
Image
None of my scripts run from this menu.


Output to the console only occurred when I copied the script text and pasted it into the console input line at the bottom and then pressed Enter. That was the only case where the script worked and the debug information was visible in the console.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 19 guests