Bug 210133 - doesn't work - python backtrace
Summary: doesn't work - python backtrace
Status: RESOLVED UNMAINTAINED
Alias: None
Product: system-config-printer-kde
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: Jonathan Riddell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-11 00:56 UTC by Sune Vuorela
Modified: 2013-11-23 20:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Vuorela 2009-10-11 00:56:58 UTC
Version:            (using KDE 4.3.1)
OS:                Linux
Installed from:    Debian testing/unstable Packages

When trying teh printer configuration utility in systemsettings, I_get the following backtrace on the console and a error message about the module can't be found:

$ Traceback (most recent call last):
  File "<string>", line 18, in kpythonpluginfactory_bridge
  File "/usr/share/kde4/apps/system-config-printer-kde/system-config-printer-kde.py", line 3997, in CreatePlugin
    kcm = u.makeui(component_data, widget_parent)
  File "/usr/share/kde4/apps/system-config-printer-kde/system-config-printer-kde.py", line 364, in makeui
    self.show_HTTP_Error(s)
  File "/usr/share/kde4/apps/system-config-printer-kde/system-config-printer-kde.py", line 1874, in show_HTTP_Error
    KMessageBox.error(self, i18n("There was an HTTP error: %1.", msg), i18n('CUPS server error'))
UnboundLocalError: local variable 'msg' referenced before assignment

I'm using sip 4.9, pyqt4.6 and pykde from kdebingdings 4.3.2
Comment 1 Sune Vuorela 2009-10-11 01:03:27 UTC
If I edit system-config-printer-kde.py and add a new line  1851, s-c-p-k seems to get quite a bit further. And I do see the Hello string.  I guess the right fix should be trivial for anyone who knows s-c-p-k code and/or python.

1850     def show_HTTP_Error(self, status):
1851         msg = "Hello Riddell"
1852         if (status == cups.HTTP_UNAUTHORIZED or
1853             status == cups.HTTP_FORBIDDEN):
1854
1855             KMessageBox.error(self,i18n('The password may be incorrect, or the '
1856                                    'server may be configured to deny '
1857                                    'remote administration.'),
1858                                    i18n('Not authorized') )
1859         else:
1860             if status == cups.HTTP_BAD_REQUEST:
1861                 msg = i18nc("HTTP error", "Bad request")
1862             elif status == cups.HTTP_NOT_FOUND:
1863                 msg = i18nc("HTTP error", "Not found")
1864             elif status == cups.HTTP_REQUEST_TIMEOUT:
1865                 msg = i18nc("HTTP error", "Request timeout")
1866             elif status == cups.HTTP_UPGRADE_REQUIRED:
1867                 msg = i18nc("HTTP error", "Upgrade required")
1868             elif status == cups.HTTP_SERVER_ERROR:
1869                 msg = i18nc("HTTP error", "Server error")
1870             elif status == -1:
1871                 msg = i18nc("HTTP error", "Not connected")
1872             else:
1873                 msg = i18nc("HTTP error", "status %1", status)
1874
1875         KMessageBox.error(self, i18n("There was an HTTP error: %1.", msg), i18n('CUPS server error'))
Comment 2 myle 2010-01-03 01:54:58 UTC
I can't confirm the error. Given the code that you pasted, msg is not defined in line 1875 if (status == cups.HTTP_UNAUTHORIZED or status == cups.HTTP_FORBIDDEN) because status is defined in the else block. Could you try putting four additional spaces before KMessageBox.error(...) in order to execute KMessageBox.error only in the else block?
Comment 3 Christoph Feck 2013-11-23 20:33:39 UTC
"system-config-printer-kde" is no longer maintained and has been replaced with "Print Manager" since KDE 4.10. The new version is a C++ rewrite of the old Python version, and may still lack some features or have some bugs.

If this or another issue still needs to be addressed in KDE 4.10 or newer, please add a comment, or report it for "Print Manager".