Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #140 from dstansby/streamtracer-warn
Browse files Browse the repository at this point in the history
Add user-friendly error when streamtracer not installed
  • Loading branch information
dstansby committed Feb 7, 2020
1 parent 7bf681d commit e2bffa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pfsspy/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ class FortranTracer(Tracer):
directly on the poles will not go anywhere.
"""
def __init__(self, max_steps=1000, step_size=0.01):
from streamtracer import StreamTracer
try:
from streamtracer import StreamTracer
except ModuleNotFoundError as e:
raise RuntimeError(
'Using FortranTracer requires the streamtracer module, '
'but streamtracer could not be loaded '
f'with the following error:\n{e}')
self.max_steps = max_steps
self.step_size = step_size
self.tracer = StreamTracer(max_steps, step_size)
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ filterwarnings =
error
ignore::ImportWarning
ignore:numpy.ufunc size changed:RuntimeWarning
ignore:.*decorator is deprecated.*:DeprecationWarning
markers =
remote_data

0 comments on commit e2bffa8

Please sign in to comment.