summaryrefslogtreecommitdiff
path: root/lib/threads/palette.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2020-04-19 18:37:41 +0200
committerGitHub <noreply@github.com>2020-04-19 18:37:41 +0200
commitd640c928d474602dfbe47a6e9a36619ee9a2330b (patch)
tree003b9e343eac12bc548fce63b571a055d53ffc93 /lib/threads/palette.py
parent478ae94b9bc07a00756e1ec82c20fe3a69de742a (diff)
fix palette issues (#660)
Diffstat (limited to 'lib/threads/palette.py')
-rw-r--r--lib/threads/palette.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/threads/palette.py b/lib/threads/palette.py
index 654c43e5..d685e5bb 100644
--- a/lib/threads/palette.py
+++ b/lib/threads/palette.py
@@ -48,13 +48,16 @@ class ThreadPalette(Set):
palette.readline()
for line in palette:
- fields = line.split("\t", 3)
- thread_color = [int(field) for field in fields[:3]]
- thread_name, thread_number = fields[3].strip().rsplit(" ", 1)
- thread_name = thread_name.strip()
-
- thread = ThreadColor(thread_color, thread_name, thread_number, manufacturer=self.name)
- self.threads[thread] = convert_color(sRGBColor(*thread_color, is_upscaled=True), LabColor)
+ try:
+ fields = line.split(None, 3)
+ thread_color = [int(field) for field in fields[:3]]
+ thread_name, thread_number = fields[3].strip().rsplit(" ", 1)
+ thread_name = thread_name.strip()
+
+ thread = ThreadColor(thread_color, thread_name, thread_number, manufacturer=self.name)
+ self.threads[thread] = convert_color(sRGBColor(*thread_color, is_upscaled=True), LabColor)
+ except ValueError:
+ continue
def __contains__(self, thread):
return thread in self.threads