mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-06 13:30:21 +08:00
Monkey-patch UmfpackContext __del__
By putting the failing statement in a try: except: clause, the exception is caught and the error message is silenced. See https://groups.google.com/d/msg/scikit-image/FrM5IGP6wh4/1hp-FtVZmfcJ and http://stackoverflow.com/questions/13977970/ignore-exceptions-printed-to-stderr-in-del/13977992?noredirect=1#comment28386412_13977992
This commit is contained in:
@@ -9,14 +9,25 @@ significantly the performance.
|
||||
"""
|
||||
|
||||
import warnings
|
||||
import sys
|
||||
import os
|
||||
|
||||
import numpy as np
|
||||
from scipy import sparse, ndimage
|
||||
|
||||
try:
|
||||
from scipy.sparse.linalg.dsolve import umfpack
|
||||
old_del = umfpack.UmfpackContext.__del__
|
||||
def new_del(self):
|
||||
try:
|
||||
old_del(self)
|
||||
except AttributeError:
|
||||
pass
|
||||
umfpack.UmfpackContext.__del__ = new_del
|
||||
UmfpackContext = umfpack.UmfpackContext()
|
||||
except:
|
||||
UmfpackContext = None
|
||||
|
||||
try:
|
||||
from pyamg import ruge_stuben_solver
|
||||
amg_loaded = True
|
||||
|
||||
Reference in New Issue
Block a user