3

I would like to load one of the scipy modules (scipy.linalg) inside a function which is exported from a python extension written in C++, so that I can then call a function from it. It would be best if the user to does not have to load the module in their python program beforehand (so PyImport_AddModule is not the solution). Code using the high level PyImport_Import like this

pckg_name = PyString_FromString("scipy.linalg");
pckg = PyImport_Import(pckg_name);`

works, as recommended here, except in Python 3.6 it produces a warning message before working.

C:\Program Files\Python36\lib\importlib\_bootstrap.py:205: 
ImportWarning: can't resolve package from __spec__ or __package__, 
falling back on __name__ and __path__
return f(*args, **kwds) 

What does the message mean? Its presence suggests I am not doing this the right way. What is the right way to do this?

JeremyR
  • 401
  • 4
  • 8
  • I have a similar problem in a large codebase, but I can't seem to find what is causing the error. `python -W error` doesn't seem to affect this warning, nor does it seem I can catch/suppress this with a filter. – uayebforever Feb 17 '18 at 08:56

0 Answers0