Skip to content

Commit

Permalink
Handling a possible error.
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed May 20, 2024
1 parent 9e8f956 commit fef14d3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docker/dataportal_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ def _dataset_colors_html(dataset_key):
percent, colors = line.split(' ', 1) # Stop after the first split

colors = [c for c in colors.split(' ') if c]
if len(colors) == 1:
r, g, b = matplotlib.colors.to_rgb(colors[0])
elif len(colors) == 3:
r, g, b = colors
else:
r, g, b, a = colors
try:
if len(colors) == 1:
r, g, b = matplotlib.colors.to_rgb(colors[0])
elif len(colors) == 3:
r, g, b = colors
else:
r, g, b, a = colors
except ValueError:
print("Could not parse colors string ", colors)
raise

colormap_list.append((float(r), float(g), float(b)))

Expand Down

0 comments on commit fef14d3

Please sign in to comment.