Public bug reported:
The system-config-printer application crashes when attempting to edit printer
properties
due to an incorrect function call to debugprint() in the options.py file.
## Steps to Reproduce:
1. Launch system-config-printer
2. Select any configured printer from the list
3. Click "Edit" button or double-click the printer icon
4. Application crashes immediately
## Error Details:
```
Traceback (most recent call last):
File "/usr/share/system-config-printer/system-config-printer.py", line 1844,
in on_edit_activate
self.dests_iconview_item_activated (self.dests_iconview, paths[0])
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 1456, in
load
self.add_job_option (option, value=value,
File "/usr/share/system-config-printer/printerproperties.py", line 835, in
add_job_option
option = options.OptionWidget(name, value, supported,
File "/usr/share/system-config-printer/options.py", line 100, in OptionWidget
return OptionSelectOneNumber(name, v, s, on_change)
File "/usr/share/system-config-printer/options.py", line 426, in __init__
debugprint("Selecting from choices:", supported[0])
TypeError: debugprint() takes 1 positional argument but 2 were given
```
## Root Cause:
In `/usr/share/system-config-printer/options.py` line 426, the debugprint()
function is called with two arguments:
```python
debugprint("Selecting from choices:", supported[0])
```
However, the debugprint() function definition in `debug.py` only accepts one
positional argument:
```python
def debugprint (x):
if _debug:
try:
sys.stderr.write (x + "\n")
sys.stderr.flush ()
except:
pass
```
## Expected Behavior:
The printer properties dialog should open without errors.
## Actual Behavior:
Application crashes with TypeError.
## System Information:
- Ubuntu Version: 22.04 LTS (jammy)
- Package: system-config-printer 1.5.16-0ubuntu3
- Architecture: amd64
- Desktop Environment: GNOME
## Proposed Fix:
Change line 426 in options.py from:
```python
debugprint("Selecting from choices:", supported[0])
```
To:
```python
debugprint("Selecting from choices: %s" % supported[0])
```
This ensures the function is called with a single string argument using proper
Python string formatting.
## Patch Attached:
I have created and tested a patch file (fix-debugprint-TypeError.patch) that
resolves this issue. The patch has been tested and the application no longer
crashes when editing printer properties.
## Impact:
This bug prevents users from editing printer properties through the GUI,
significantly impacting the usability of system-config-printer.
## Additional Notes:
This issue should also be reported upstream to Red Hat, as they maintain the
original system-config-printer project.
** Affects: system-config-printer (Ubuntu)
Importance: Undecided
Status: New
** Tags: crash printer-configuration
** Patch added: "e debugprint() function in debug.py only accepts a single
positional argument, but it was being called with two arguments in options.py
at line 426, causing a TypeError when users attempt to edit printer properties.
This patch fixes the issue by using proper Python string formatting to combine
the arguments into a single string before passing to debugprint()."
https://bugs.launchpad.net/bugs/2140765/+attachment/5943373/+files/fix-debugprint-TypeError-with-description.patch
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2140765
Title:
typeerror in printer.py file resulted crashes multiple times
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/system-config-printer/+bug/2140765/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs