eoyilmaz / displaycal-py3

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

Fail to start with 'NameError: name 'GetXRandROutputXID' is not defined' #390

Closed marillat closed 1 month ago

marillat commented 1 month ago

Describe the bug I can fin and existing issue with this error. Fail to start with this error

$ displaycal 
Acquired lock file: <DisplayCAL.main.AppLock object at 0x7f29f81fe6f0>
displaycal 0.0.0 1970-01-01T00:00:00Z
debian n/a trixie x86_64
Python 3.12.4 (main, Jul 15 2024, 12:17:32) [GCC 13.3.0]
Faulthandler 
wxPython 4.2.1 gtk3 (phoenix) wxWidgets 3.2.5
Encoding: utf-8
File system encoding: utf-8
Loading /home/marillat/.config/dispcalGUI/dispcalGUI.ini
listening
writing to lock file: port: 15411
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DisplayCAL/main.py", line 550, in main
    _main(module, name, app_lock_file_name)
  File "/usr/lib/python3/dist-packages/DisplayCAL/main.py", line 467, in _main
    from DisplayCAL.wxwindows import BaseApp
  File "/usr/lib/python3/dist-packages/DisplayCAL/wxwindows.py", line 28, in <module>
    from DisplayCAL import ICCProfile as ICCP
  File "/usr/lib/python3/dist-packages/DisplayCAL/ICCProfile.py", line 51, in <module>
    from DisplayCAL import edid
  File "/usr/lib/python3/dist-packages/DisplayCAL/edid.py", line 43, in <module>
    from DisplayCAL import RealDisplaySizeMM as RDSMM
  File "/usr/lib/python3/dist-packages/DisplayCAL/RealDisplaySizeMM.py", line 47, in <module>
    _GetXRandROutputXID = GetXRandROutputXID
                          ^^^^^^^^^^^^^^^^^^
NameError: name 'GetXRandROutputXID' is not defined
┌──────────────────────────────────────────────────────────────────────────────┐
│ Traceback (most recent call last):                                           │
│   File "/usr/lib/python3/dist-packages/DisplayCAL/main.py", line 550, in     │
│ main                                                                         │
│     _main(module, name, app_lock_file_name)                                  │
│   File "/usr/lib/python3/dist-packages/DisplayCAL/main.py", line 467, in     │
│ _main                                                                        │
│     from DisplayCAL.wxwindows import BaseApp                                 │
│   File "/usr/lib/python3/dist-packages/DisplayCAL/wxwindows.py", line 28, in │
│ <module>                                                                     │
│     from DisplayCAL import ICCProfile as ICCP                                │
│   File "/usr/lib/python3/dist-packages/DisplayCAL/ICCProfile.py", line 51,   │
│ in <module>                                                                  │
│     from DisplayCAL import edid                                              │
│   File "/usr/lib/python3/dist-packages/DisplayCAL/edid.py", line 43, in      │
│ <module>                                                                     │
│     from DisplayCAL import RealDisplaySizeMM as RDSMM                        │
│   File "/usr/lib/python3/dist-packages/DisplayCAL/RealDisplaySizeMM.py",     │
│ line 47, in <module>                                                         │
│     _GetXRandROutputXID = GetXRandROutputXID                                 │
│                           ^^^^^^^^^^^^^^^^^^                                 │
│ NameError: name 'GetXRandROutputXID' is not defined                          │
└──────────────────────────────────────────────────────────────────────────────┘
Exiting displaycal
Ran application exit handlers
p5k369 commented 1 month ago

Hey @marillat, how did you install displaycal? Are you using a package provided by the distro you are using? Displaycal won't work with python 3.12 and the main branch out of the box, atm. (you can make it work with some little adjustments) Also this line looks concerning:

File "/usr/lib/python3/dist-packages/DisplayCAL/main.py", line 550, in main

That means that displaycal has been installed into your systems python installation. That is not recommended, because it can break other packages or you are more likely to get dependencies issues.

marillat commented 1 month ago

Hey @marillat, how did you install displaycal? Are you using a package provided by the distro you are using? Displaycal won't work with python 3.12 and the main branch out of the box, atm. (you can make it work with some little adjustments)

The error log said debian. It's problematic, python 3.11 is scheduled to be removed from testing/unstable and the next stable release.

p5k369 commented 1 month ago

Hey @marillat, sure it says debian, because you are on debian, but how did you install displaycal? Via package provided by your distro, or did you clone the displaycal repo and if you cloned it, are you on main or develop?

If you have problems with the displaycal package provided by your distro, please contact the maintainer.

If you cloned the main branch from here, you should not get to that point and get a message like: RuntimeError: Need Python version >= 3.8 <= 3.11, got 3.12.3 As I mentioned above, it is possible to make the main branch also run with 3.12, but it is easier to just clone develop. If you cloned the develop branch from here, you probably forgot to make build.

The reason for that inconvenience is that atm wxPython and python 3.12 are not a perfect match without patching which causes displaycal to segfault (at least on closing). You can read about that here: https://github.com/wxWidgets/Phoenix/issues/2455

marillat commented 1 month ago

Hey @marillat, sure it says debian, because you are on debian, but how did you install displaycal? Via package provided by your distro, or did you clone the displaycal repo and if you cloned it, are you on main or develop?

By package as I'm the Debian maintainer for displaycal :)

If you cloned the main branch from here, you should not get to that point and get a message like: RuntimeError: Need Python version >= 3.8 <= 3.11, got 3.12.3 As I mentioned above, it is possible to make the main branch also run with 3.12, but it is easier to just clone develop.

Yes, I already tested that with commit e7c6640 and the result is the error I reported here.

The reason for that inconvenience is that atm wxPython and python 3.12 are not a perfect match without patching which causes displaycal to segfault (at least on closing).

Yes, I noticed that by reading the issue tracker.

p5k369 commented 1 month ago

Yes, I already tested that with commit e7c6640 and the result is the error I reported here.

That won't work. The first commit that made the develop branch build and run with python-3.12 is this one: https://github.com/eoyilmaz/displaycal-py3/commit/2cca1f31c1f5d66013e6fb9ab00605bb46a7db4b You are missing a place to build RealdisplaySizeMM in and also the import.

marillat commented 1 month ago

Thanks @p5k369, 2cca1f3 fix this issue. Otherwise I don't see a crash when I quit displaycal.