Fatal Python error when importing fusionscript.so

User avatar
Igor Ridanovic
Posts: 28
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Fatal Python error when importing fusionscript.so

#1

Post by Igor Ridanovic » Sat Sep 01, 2018 4:25 pm

I'm having an issue with a line in the BMD supplied DaVinciResolveScript.py on High Sierra with Anaconda Python 2.7.15. The line is importing fusionscript.so, where the 'path' contains the valid path to the MacOS location of fusionscript.so. It looks similar to this:
  1. script_module = imp.load_dynamic("fusionscript", path + "fusionscript.so")
It throws :
  1. Fatal Python error: PyhreadState_Get: no current thread
  2. Abort trap: 6
I suspect this has to do with multiple Python interpreters on the host. In fact, if I disable the Anaconda Python and use the stock 2.7.10 Python that came installed with High Sierra, I can import fusionscript.so and the Resolve scripting API is fully operational.

Prior to installing the Anaconda version, I used Brew to install Python and faced the same issue. This is not really a problem with fusionscript.so. I suspect that importing any other shared object is affected. Other than this issue with imp.load_dynamic() the Anaconda Python seems to work fine.

I know this is a Lua-centric community, but I'll take any tips on properly installing and configuring Python 2.x on MacOS. And, yes, I'm very curious about Lua, but for now I need to stick to what I know.

User avatar
Igor Ridanovic
Posts: 28
Joined: Mon Apr 16, 2018 11:17 pm
Location: Los Angeles
Been thanked: 3 times
Contact:

Re: Fatal Python error when importing fusionscript.so

#2

Post by Igor Ridanovic » Tue Sep 18, 2018 11:41 am

Anyone interested in this subject may like to know that with a help of eight or so Resolve users we tested the import of fusionscript.so on MacOS. It failed with user installed Pythons, it succeeded with the stock 2.7 Python. This has negative implications since the default Python is not the best choice.

User avatar
bfloch
Fusioneer
Posts: 93
Joined: Wed Aug 06, 2014 4:25 pm
Been thanked: 4 times

Re: Fatal Python error when importing fusionscript.so

#3

Post by bfloch » Wed Sep 19, 2018 2:41 pm

I suggest you compare the build flags of both python versions.

First I would suggest comparing these (like indicated in another thread):

https://stackoverflow.com/questions/144 ... 2-or-ucs-4

User avatar
llamafilm
Posts: 8
Joined: Thu May 23, 2019 8:42 am

Re: Fatal Python error when importing fusionscript.so

#4

Post by llamafilm » Sun Jun 02, 2019 8:42 pm

It works for me using MacPorts on Mojave.

Code: Select all

sudo port install python36
sudo port select python python36

User avatar
Iddos
Posts: 18
Joined: Sat Oct 06, 2018 4:21 pm
Been thanked: 2 times

Re: Fatal Python error when importing fusionscript.so

#5

Post by Iddos » Thu Jun 06, 2019 9:48 am

Hi
Not sure if this will solve your issue.
I had the same thing with brew. I don't use anaconda.
I solved it by setting the python 2.7 path in the .bash_profile.
Then setting Resolve env like instructed in the developers documentation and it seemed to work.