Skip to content

Commit

Permalink
Add try/except block around skcuda.fft import to ensure ImportError (#…
Browse files Browse the repository at this point in the history
…3403)

* Add try/except block around skcuda.fft import to ensure ImportError

* Address CC line length issue
  • Loading branch information
josh-willis authored Aug 1, 2020
1 parent 74f3245 commit 58c62ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pycbc/fft/cufft.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@
"""

import pycbc.scheme
import skcuda.fft as cu_fft
# The following is a hack, to ensure that any error in importing
# cufft is treated as the module being unavailable at runtime.
# Ideally, the real error and its traceback would be appended to
# the ImportError we raise here. But the method to do that is very
# different between python 2 and python 3.
try:
import skcuda.fft as cu_fft
except:
raise ImportError("Unable to import skcuda.fft; try direct import"
" to get full traceback")
from .core import _BaseFFT, _BaseIFFT

_forward_plans = {}
Expand Down

0 comments on commit 58c62ef

Please sign in to comment.