Skip to content

Commit

Permalink
Move jinja2 check lower
Browse files Browse the repository at this point in the history
  • Loading branch information
tbennun authored Oct 30, 2024
1 parent 9267904 commit 0c8cd0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dace/cli/sdfv.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ def view(sdfg: dace.SDFG, filename: Optional[Union[str, int]] = None, verbose: b
blocking the current thread.
:param verbose: Be verbose.
"""
try:
import jinja2
except (ImportError, ModuleNotFoundError):
raise ImportError('SDFG.view() requires jinja2, please install by running `pip install jinja2`')

# If vscode is open, try to open it inside vscode
if filename is None:
if (
Expand All @@ -52,6 +47,11 @@ def view(sdfg: dace.SDFG, filename: Optional[Union[str, int]] = None, verbose: b
os.close(fd)
return

try:
import jinja2
except (ImportError, ModuleNotFoundError):
raise ImportError('SDFG.view() requires jinja2, please install by running `pip install jinja2`')

if type(sdfg) is dace.SDFG:
sdfg = dace.serialize.dumps(sdfg.to_json())

Expand Down

0 comments on commit 0c8cd0b

Please sign in to comment.