diff options
Diffstat (limited to 'lib/threads/palette.py')
| -rw-r--r-- | lib/threads/palette.py | 17 |
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 |
