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

オープン
#385 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@xovishnukosuri がすでに取り組んでいます。

2026年3月14日 から。

  • #427 @xovishnukosuri による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
desktop

調査の方向性

printerproperties.py の add_job_option から始め、次に traceback が値を int() で変換している options.py の OptionWidget 周辺を調べます。プリンターのプロパティを開いて失敗を再現し、job-cancel-after の None 値の処理をレポートで提案されている 2 つの修正と比較します。プロパティダイアログが traceback なしで開けば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
209
フォーク
111
平均マージ
2日 3時間
マージ済み PR(30日)
8

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenPrinting/system-config-printer のほかの issue

OpenPrinting/system-config-printer の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。