Skip to content

Commit

Permalink
Put a proper warning when sankey is not installed
Browse files Browse the repository at this point in the history
Following multiple bug report in this sense.
  • Loading branch information
Pierre-Sassoulas committed Jan 24, 2021
1 parent cdf77c2 commit 51ef2e2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions survey/exporter/tex/question2tex_sankey.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# -*- coding: utf-8 -*-

import logging
import warnings

from django.utils.translation import gettext_lazy as _
from pandas.core.frame import DataFrame
#try:
from pysankey import sankey
#except ModuleNotFoundError:
# from pySankey import sankey
try:
from pysankey import sankey
except ModuleNotFoundError:
warnings.warn(
"Cannot import 'sankey', please install the package using
"the sankey extra. (pip install django-survey-and-report[sankey])"
)

from survey.exporter.tex.question2tex import Question2Tex
from survey.models.question import Question
Expand Down

0 comments on commit 51ef2e2

Please sign in to comment.