[SciPy-dev] crash with 'import scipy.linalg' and 'import scipy.io'

Robert Kern robert.kern at gmail.com
Thu Mar 8 19:02:41 EST 2007


John Pye wrote:
> Hi Ravi
> 
> Thanks for the reply, and I'm pleased to hear that you've had success
> with what I'm trying to do. Did that backtrace mean anything to you?
> 
> The only other place numpy is used in my code is in the highest-level,
> which is a python GUI written on top of my SWIG-wrapped C library. The
> latest thing is that I have attempted to make some python callbacks from
> *plugins* in the low-level C code, which, being plugins, didn't have
> access to all the SWIG wrappings. So numpy is being imported twice but
> in different 'frames'. I bet that something scipy/numpy is assuming with
> regard to global variables is what's falling over. Other modules have
> imported OK: sys, io, subprocess. Just not scipy.io or scipy.linalg.

Or anything else that uses numpy. numpy does not currently allow being imported
from multiple interpreters in the same process because of those global
variables. Unfortunately, those variables can't be trivially removed (although
if you figure out a workaround, I would love to hear it).

However, embedding a Python interpreter in a C extension to a Python program is
probably not a good idea regardless, and I'm not entirely sure why you would
need to do so.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-Dev mailing list