From d640c928d474602dfbe47a6e9a36619ee9a2330b Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 19 Apr 2020 18:37:41 +0200 Subject: fix palette issues (#660) --- lib/threads/palette.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/threads/palette.py') 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 -- cgit v1.2.3