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
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'))
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?
"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".