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

Aperta
#385 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@xovishnukosuri ci sta già lavorando.

Dal 14/3/2026.

  • #427 di @xovishnukosuri — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
desktop

Direzione di ricerca

Inizia in printerproperties.py, in add_job_option, quindi esamina options.py intorno a OptionWidget, dove il traceback converte il valore con int(). Riproduci l’errore aprendo le proprietà di una stampante e confronta la gestione del valore None di job-cancel-after con le due correzioni proposte nel report; il lavoro è completato quando la finestra di dialogo delle proprietà si apre senza il traceback.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
Python
Stelle
209
Fork
111
Merge medio
2g 3h
PR unite (30g)
8

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenPrinting/system-config-printer

Tutte le issue di OpenPrinting/system-config-printer

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.