0

I have a big C++ module with Python 3 bindings using Boost.Python, that I compile to a .so file using CMake on macOS.

When I try to import it in the REPL, everything seems to work fine:

>>>import myModule
>>>

However, as soon as I run the import statement, the famous rocket icon of Python shows up in the Dock and stays there jumping for some minutes and stops after. Obviously then, I cannot access any of the functions defined in my module, so the import looks fine but doesn't actually do anything.

I tried looking in the Console and saw that whenever I import myModule, I get two launchservicesd[83]: SecTaskLoadEntitlements failed error=22. It brought me to this and that related questions but I can't find what the exact problem is.

The C++ module is huge so I just can't look at the code and find the problem, thus I'm asking for any hints about at least how to debug that problem.

Community
  • 1
  • 1
filaton
  • 2,257
  • 17
  • 27
  • Does "myModule.so" have any so dependencies, and if so, are they on the os/shell path which would be used for those? The module itself is found by the PYTHONPATH, but the shared library dependencies are not. – Kenny Ostrom Mar 23 '17 at 22:12
  • Thank you for your answer! The "myModule.so" has "so" dependencies but those are very standard (the result of `otool -L myModule.so` can be found [there](http://pastebin.com/1fNEDmbv)). I tried adding all those paths to my PYTHONPATH but it doesn't change anything. – filaton Mar 24 '17 at 10:29
  • It's hard to say what is happening. Try to comment everything (inside BOOST_PYTHON_MODULE(myModule)), then compile and run. Doest it run? In case yes, try to uncomment some blocks until you find the problem. – Hugo Corrá Mar 24 '17 at 13:07
  • Don't add the paths to your python path. You don't want to be looking for python modules there. Just make sure the relevant os path settings are correct. Since that wasn't it, do what Hugo said. Start from the ground up and you will find where it breaks, and that should give a strong hint on how to fix it (or at least how to show the problem in your question here). – Kenny Ostrom Mar 24 '17 at 15:18

1 Answers1

0

I can suggest the following steps:

  • Try to import that module though local python session. So, run interactive python interpreter, and 'import myModule'.

If bad, try to check:

  • are python version, with which myMoudle was linked with, is similiar to used interpreter
  • check that build architectires are the same
  • check that you can load even simple boost.python example module

If ok, check that you have correctly set up module search path in your python code.

Kirill Suetnov
  • 145
  • 1
  • 5