digitaltrails / vdu_controls

VDU controls - a control panel for monitor brightness/contrast/...
GNU General Public License v3.0
103 stars 4 forks source link

Error: TypeError: can only concatenate str (not "NoneType") to str [After update and reinstall] #70

Closed Milor123 closed 4 months ago

Milor123 commented 5 months ago

Hi bro !!! Today I've a git pull && python vdu_controls.py --install and it breaks my VDU I am using ddcutil 2.0

image

I am in Manjaro KDE Plasma with X11, NVIDIA proprietary drivers.

This is the program log:

Details: Traceback (most recent call last):
  File "/home/noe/bin/vdu_controls", line 8374, in <module>
    main()
  File "/home/noe/bin/vdu_controls", line 8296, in main
    VduAppWindow(main_config, app, main_controller)  # may need to assign this to a variable to prevent garbage collection?
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/noe/bin/vdu_controls", line 7772, in __init__
    self.main_controller.configure_application(self)
  File "/home/noe/bin/vdu_controls", line 7188, in configure_application
    self.main_window.create_main_control_panel()
  File "/home/noe/bin/vdu_controls", line 7889, in create_main_control_panel
    self.main_panel.initialise_control_panels(self.main_controller.vdu_controllers_map, self.app_context_menu, self.main_config,
  File "/home/noe/bin/vdu_controls", line 3558, in initialise_control_panels
    vdu_control_panel = VduControlPanel(controller, self.display_vdu_exception)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/noe/bin/vdu_controls", line 3123, in __init__
    self.refresh_from_vdu()
  File "/home/noe/bin/vdu_controls", line 3135, in refresh_from_vdu
    control.update_from_vdu(value)
  File "/home/noe/bin/vdu_controls", line 2880, in update_from_vdu
    self.refresh_ui_view()
  File "/home/noe/bin/vdu_controls", line 2913, in refresh_ui_view
    self._refresh_ui_view_task()
  File "/home/noe/bin/vdu_controls", line 2918, in _refresh_ui_view_task
    self.refresh_ui_view_implementation()
  File "/home/noe/bin/vdu_controls", line 3059, in refresh_ui_view_implementation
    self.validate_value()
  File "/home/noe/bin/vdu_controls", line 3065, in validate_value
    self.combo_box.addItem('UNKNOWN-' + self.get_current_text_value(), self.current_value)
                           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

And this is the console log:

python vdu_controls.py
13:20:47 INFO: VDU Controls 2.0.0 vdu_controls.py  
13:20:47 INFO: python-locale: ('es_CO', 'UTF-8') Qt-locale: en_US
13:20:47 INFO: app-style: breeze (detected a dark theme)
13:20:47 INFO: Looking for config file '/home/noe/.config/vdu_controls/vdu_controls.conf'
13:20:47 INFO: Using config file '/home/noe/.config/vdu_controls/vdu_controls.conf'
13:20:47 INFO: Logging to stdout
13:20:47 INFO: Reading autolux file '/home/noe/.config/vdu_controls/AutoLux.conf'
13:20:47 INFO: native_font_height_pixels=18
13:20:47 INFO: Using system tray.
13:20:48 INFO: Configuring application (reconfiguring=False)...
13:20:48 ERROR: Sanity check of com.ddcutil.DdcutilInterface failed: The name is not activatable
13:20:48 WARNING: Failed to detect D-Bus ddcutil-service, falling back to the ddcutil command.
13:20:48 INFO: ddcutil version (2, 0, 0)  (dynamic-sleep=True) - interface Command Line - ddcutil
13:20:50 INFO: Number of detected monitors is stable at 1 (loop=2)
13:20:50 INFO: Initializing controls for vdu_number='1' vdu_model_name='PA248QV' self.vdu_stable_id='PA248QV_M4LMQS006956'
13:20:50 INFO: Using config file '/home/noe/.config/vdu_controls/PA248QV_M4LMQS006956.conf'
13:20:50 WARNING: Failed to allocate shortcut for Sole 7PM reserved shortcuts=['P', 'G', 'A', 'C', 'L', 'S', 'R', 'T', 'H', 'Q', 'N', 'O', 'E', ' ', 'M', '7', '6']
13:20:50 INFO: splash_message: 'DDC ID 1\nPA248QV:M4LMQS006956'
13:20:50 ERROR: 
Traceback (most recent call last):
  File "/home/noe/vdu_controls/vdu_controls.py", line 8374, in <module>
    main()
  File "/home/noe/vdu_controls/vdu_controls.py", line 8296, in main
    VduAppWindow(main_config, app, main_controller)  # may need to assign this to a variable to prevent garbage collection?
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/noe/vdu_controls/vdu_controls.py", line 7772, in __init__
    self.main_controller.configure_application(self)
  File "/home/noe/vdu_controls/vdu_controls.py", line 7188, in configure_application
    self.main_window.create_main_control_panel()
  File "/home/noe/vdu_controls/vdu_controls.py", line 7889, in create_main_control_panel
    self.main_panel.initialise_control_panels(self.main_controller.vdu_controllers_map, self.app_context_menu, self.main_config,
  File "/home/noe/vdu_controls/vdu_controls.py", line 3558, in initialise_control_panels
    vdu_control_panel = VduControlPanel(controller, self.display_vdu_exception)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/noe/vdu_controls/vdu_controls.py", line 3123, in __init__
    self.refresh_from_vdu()
  File "/home/noe/vdu_controls/vdu_controls.py", line 3135, in refresh_from_vdu
    control.update_from_vdu(value)
  File "/home/noe/vdu_controls/vdu_controls.py", line 2880, in update_from_vdu
    self.refresh_ui_view()
  File "/home/noe/vdu_controls/vdu_controls.py", line 2913, in refresh_ui_view
    self._refresh_ui_view_task()
  File "/home/noe/vdu_controls/vdu_controls.py", line 2918, in _refresh_ui_view_task
    self.refresh_ui_view_implementation()
  File "/home/noe/vdu_controls/vdu_controls.py", line 3059, in refresh_ui_view_implementation
    self.validate_value()
  File "/home/noe/vdu_controls/vdu_controls.py", line 3065, in validate_value
    self.combo_box.addItem('UNKNOWN-' + self.get_current_text_value(), self.current_value)
                           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

but when execute with sudo, it works, could be it mistake with the old configuration? All is working very nice before of update.

Milor123 commented 5 months ago

I've solved it deleting the profile config of my monitor ~/.config/vdu_controls/PA248QV_M4LMQS006956.conf

digitaltrails commented 5 months ago

I've solved it deleting the profile config of my monitor ~/.config/vdu_controls/PA248QV_M4LMQS006956.conf

I'm glad that you were able to work around the issue.

Had you manually edit the original file? Or perhaps you were just updating/upgrading from and earlier vdu_controls?

I'd hoped vdu_controls wouldn't fail so easily. If you'd like me to investigate further, could post the offending file and I can see if I can make the code more robust.

digitaltrails commented 5 months ago

Thanks for reporting this, version 2.0 contains quite a few changes, it's nice to get some feedback. I've pushed change 707cb43 which checks for a None value on combo-boxes. I'm not sure how that can happen, but the code should now handle it without falling over. From brief inspection, it seems like the rest of the user interface will cope with the None value.

Milor123 commented 5 months ago

I've solved it deleting the profile config of my monitor ~/.config/vdu_controls/PA248QV_M4LMQS006956.conf

I'm glad that you were able to work around the issue.

Had you manually edit the original file? Or perhaps you were just updating/upgrading from and earlier vdu_controls?

I'd hoped vdu_controls wouldn't fail so easily. If you'd like me to investigate further, could post the offending file and I can see if I can make the code more robust.

Thank bro !!!, I never edited manually the PA248QV_M4LMQS006956.conf

This was my config bugged file: PA248QV_M4LMQS006956.conf.zip

I love you !!! 😘

PD: Question, how can search for get a Lux meter for connect in USB or tty mode? I've found a "Yocto-Light-V4" but is in other country, and I need something that can be shipped to USA or Colombia countries.

digitaltrails commented 5 months ago

PD: Question, how can search for get a Lux meter for connect in USB or tty mode?

I didn't search much beyond the Arduino+bh1750 (because an Arduino+BH1750/GY30 is so cheap, and it's easy to build). But "Linux lux meter" would be what I started with. I don't think there are many options for Linux.

I've found a "Yocto-Light-V4" but is in other country, and I need something that can be shipped to USA or Colombia countries.

I imagine an arduino and bh1750/gy30 to be widely available from many suppliers in the US.

I've found a USB webcam to be pretty effective. I was given an old Logitech C270, there must be heaps of them around new or second hand.

Milor123 commented 5 months ago

PD: Question, how can search for get a Lux meter for connect in USB or tty mode?

I didn't search much beyond the Arduino+bh1750 (because an Arduino+BH1750/GY30 is so cheap, and it's easy to build). But "Linux lux meter" would be what I started with. I don't think there are many options for Linux.

I've found a "Yocto-Light-V4" but is in other country, and I need something that can be shipped to USA or Colombia countries.

I imagine an arduino and bh1750/gy30 to be widely available from many suppliers in the US.

I've found a USB webcam to be pretty effective. I was given an old Logitech C270, there must be heaps of them around new or second hand.

Ohh it looks very cheap, Thank u very much, try buy it in aliexpress