eoyilmaz / displaycal-py3

DisplayCAL Modernization Project
https://eoyilmaz.github.io/displaycal-py3/
GNU General Public License v3.0
847 stars 60 forks source link

Cannot load local setting #384

Closed enokoneko closed 3 weeks ago

enokoneko commented 4 months ago

Describe the bug UI worked but cannot load local setting.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'File > load settings'
  2. Click on '/Library/ColorSync/Profiles/Displays/xxx.icc'
  3. See error
    
    cannot access local variable 'cal' where it is not associated with a value

Traceback (most recent call last): File "/Users/xxx/displaycal-py3/.venv/lib/python3.12/site-packages/wx/core.py", line 3427, in lambda event: event.callable(*event.args, **event.kw) ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/xxx/displaycal-py3/.venv/lib/python3.12/site-packages/DisplayCAL/wxaddons.py", line 852, in process self.drophandlersext File "/Users/xxx/displaycal-py3/.venv/lib/python3.12/site-packages/DisplayCAL/display_cal.py", line 2349, in cal_drop_handler self.load_cal_handler(None, path) File "/Users/xxx/displaycal-py3/.venv/lib/python3.12/site-packages/DisplayCAL/display_cal.py", line 17741, in load_cal_handler ti3_lines = [line.strip() for line in cal] ^^^ UnboundLocalError: cannot access local variable 'cal' where it is not associated with a value



**Expected behavior**
Load the setting so I can modify the icc profile manually and save it. Because I don't have an instrument.

**Versions (please complete the following information):**
 - macOS 14.5
 - Python 3.12.4
 - ArgyllCMS 3.2.0
 - DisplayCAL 3.9.12
<img width="480" alt="image" src="https://github.com/eoyilmaz/displaycal-py3/assets/22033645/db599275-7360-4abe-a1b6-04f3ab170538">
p5k369 commented 2 months ago

Hey @enokoneko are you sure you have permission to read the file you are trying to load? And if so, can you please provide that file?

Headcrabed commented 2 months ago

Hi @eoyilmaz I also met this problem. I tried ref icc file come with argyllcms and also the display p3 icc from https://www.color.org/chardata/rgb/DisplayP3.xalter and have the same result. I'm using windows 11 + python 3.11.9 + pypi version of displaycal 3.9.12.

eoyilmaz commented 1 month ago

I'm going to release DisplayCAL 3.9.13 soon (may be today), please try it and report if the proplem still exists.

eoyilmaz commented 3 weeks ago

Okay I can reproduce this with DisplayCAL 3.9.14.dev + Python 3.13 :

Ready.
Setting up scripting host at 127.0.0.1:15411
Check for application update...
DisplayCAL is up-to-date.
ArgyllCMS is up-to-date.
NoneType: None
┌──────────────────────────────────────────────────────────────────────────────┐
│ Traceback (most recent call last):                                           │
│   File                                                                       │
│ "/Users/eoyilmaz/Documents/development/displaycal-py3/DisplayCAL/display_cal.py", │
│ line 17777, in load_cal_handler                                              │
│     ti3_lines = [line.strip() for line in cal]                               │
│                                           ^^^                                │
│ UnboundLocalError: cannot access local variable 'cal' where it is not        │
│ associated with a value                                                      │
└──────────────────────────────────────────────────────────────────────────────┘
NoneType: None
┌──────────────────────────────────────────────────────────────────────────────┐
│ Traceback (most recent call last):                                           │
│   File                                                                       │
│ "/Users/eoyilmaz/Documents/development/displaycal-py3/DisplayCAL/display_cal.py", │
│ line 17777, in load_cal_handler                                              │
│     ti3_lines = [line.strip() for line in cal]                               │
│                                           ^^^                                │
│ UnboundLocalError: cannot access local variable 'cal' where it is not        │
│ associated with a value                                                      │
└──────────────────────────────────────────────────────────────────────────────┘
eoyilmaz commented 3 weeks ago

Okay so, from what I understand from the code, this feature is only supported for profiles that are generated with ArgyllCMS and it requires to contain a targ tag with proper data.

I updated the code so it will inform the user if the ICC profile is not supported:

image