Hide Forgot
Description of problem: When running system-config-printer (as root) to install a printer, I am unable to select a local printer driver (PPD): As soon as I click on the "local driver" in the "new printer" dialogue, the program stops working. On STDERR I get a Python exception (details below). Version-Release number of selected component (if applicable): system-config-printer 1.4.1_7.fc19 How reproducible: Always Steps to Reproduce: 1. Run `sudo system-config-printer` 2. Select a printer for which no pre-packaged driver is available 3. Wait until the automated driver search has completed (not finding any driver); do not cancel the search procedure even if it takes 1 minute 4. Select "local driver" Actual results: A Python exception thrown on STDERR: Traceback (most recent call last): File "/usr/share/system-config-printer/newprinter.py", line 892, in on_btnNPForward_clicked self.nextNPTab() File "/usr/share/system-config-printer/newprinter.py", line 1110, in nextNPTab if driver != None and driver.has_key ('packages'): AttributeError: 'int' object has no attribute 'has_key' Expected results: The dialogue to continue. Additional info: As reported by the Python exception, the problem is caused by this line (line no. 1110) in newprinter.py: if driver != None and driver.has_key ('packages'): The reason is that `driver` is not actually `None`, but the integer `0`. I was able to fix the problem by replacing that line with the following if driver is not None and driver != 0 and driver.has_key ('packages'): With this in place, the dialogue continues and I am able to install the printer.
Looking at the current version of the code (master branch), the line I mentioned seems to correspond to line 1125: https://git.fedorahosted.org/cgit/system-config-printer.git/tree/newprinter.py#n1125 There are other lines in this code that compare `driver` (returned from `model.get_value()` to `None`. I suspect they all need to be prepared for the possibility of a value of `0` instead of `None`.
(In reply to Johannes Goller from comment #0) > 4. Select "local driver" I can't find any "local driver". I see only: * Select printer from database * Provide PPD file * Search for a printer driver to download The affected code seem to handle the last case but I can't reproduce it. > if driver is not None and driver != 0 and driver.has_key ('packages'): nice, thanks, but we need to know how/why the 0 got there, it could contain other values, not just 0.
>> 4. Select "local driver" > I can't find any "local driver". I see only: > * Select printer from database > * Provide PPD file > * Search for a printer driver to download I am sorry. I was looking at the Japanese version and made assumptions about the English original... It's the "provide a PPD file" option, then. > nice, thanks, but we need to know how/why the 0 got there, it could contain other values, not just 0. Sure, my fix is very ad-hoc.
Tracked the cause of this down to commit b21756ca49e22feb3d055be331739707254516a7: Commit: Tim Waugh <twaugh@redhat.com> CommitDate: Fri Nov 9 18:12:12 2012 +0000 Avoid putting None in models whose columns don't allow it. I should have checked for comparisons elsewhere in the code, and for some reason I missed this. Thanks for the patch. I've applied it now.
system-config-printer-1.4.5-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/system-config-printer-1.4.5-1.fc20
Package system-config-printer-1.4.5-1.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing system-config-printer-1.4.5-1.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-8100/system-config-printer-1.4.5-1.fc20 then log in and leave karma (feedback).
system-config-printer-1.4.5-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.