I am trying to solve the following problem: Let's say I have a Python script (let him call it Test.py) that uses the C ++ extension module (done via SWIG, call the Example module). I have Test.py, Example.py and _Example.so in the same directory.
Now, in the middle of running Test.py, I want to make changes to my Example module, recompile (which will overwrite the existing .so) and use the command to gracefully stop Test.py, which is still using the old version of the module (Test.py does some a cleanup that uses some of the things that are defined in the Example module), and then run it again using the new version of the module. Gracefully stopping Test.py and THEN, recompiling the module in my case is not an option.
The problem is that as soon as _Example.so is overwritten and Test.py tries to access something defined in the Example module (with a competent stop), I get a segmentation error. One solution to this is to explicitly specify the Example module by adding the version number at the end, but I was wondering if there was a better solution (I don't want to import Example_1_0)?
source
share