system-config-printer icon indicating copy to clipboard operation
system-config-printer copied to clipboard

system-config-printer can't open printer properties because job-cancel-after value is None

Open jikamens opened this issue 1 year ago • 1 comments

I have system-config-printer 1.5.18-3 from Debian Testing. All my other CUPS etc. packages are up-to-date.

When I run system-config-printer, unlock it, and try to open the properties for a printer, nothing happens in the UI. In the terminal window from which I started system-config-printer I see a stack trace:

Traceback (most recent call last):
  File "/usr/share/system-config-printer/system-config-printer.py", line 597, in dests_iconview_item_activated
    self.propertiesDlg.show (name, host=self.connect_server,
  File "/usr/share/system-config-printer/printerproperties.py", line 579, in show
    self.load (name, host=host, encryption=encryption, parent=parent)
  File "/usr/share/system-config-printer/printerproperties.py", line 1457, in load
    self.add_job_option (option, value=value,
  File "/usr/share/system-config-printer/printerproperties.py", line 836, in add_job_option
    option = options.OptionWidget(name, value, supported,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/system-config-printer/options.py", line 84, in OptionWidget
    v = int(v)
        ^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

I modified printerproperties.py to indicate what option name and value are being processed right before this stack trace happens, and it said it was job-cancel-after with a value of None.

I don't know if this is the correct fix, but I made the problem go away with this change:

--- printerproperties.py~       2024-06-06 11:58:59.000000000 -0400
+++ printerproperties.py        2024-12-28 20:26:43.889878034 -0500
@@ -832,7 +832,7 @@
     def add_job_option(self, name, value = "", supported = "", is_new=True,
                        editable=True):
         try:
-            option = options.OptionWidget(name, value, supported,
+            option = options.OptionWidget(name, value or "", supported,
                                           self.option_changed)
         except ValueError:
             # We can't deal with this option type for some reason.

I suppose another option would be to change the except statement there from ValueError to (ValueError, TypeError).

jikamens avatar Dec 29 '24 01:12 jikamens

Ok

A2Zwholesalediscounters avatar Sep 16 '25 00:09 A2Zwholesalediscounters