#624103 system-config-printer: Verifing samba printer access causes pysmb import

#624103#5
Date:
2011-04-25 14:39:21 UTC
From:
To:
Select smb printer, select 'properties', 'Change' after 'Make and Model'.
Then  select 'Windows printer via SAMBA', put printer URI after 'smb://'.
Select verify. Thr stderror shows the following run-time error:
$ system-config-printer
....
Caught non-fatal exception. Traceback:
File "/usr/bin/system-config-printer", line 5546, in on_btnSMBVerify_clicked
 smbc_auth = pysmb.AuthContext (self.NewPrinterWindow,
NameError: global name 'pysmb' is not defined
Continuing anyway..

(and we'll see some strange error message in GUI even if printer is ok).

File pysmb.py is included in system-config-printer package.
Still, was it imported too late in this case.
Using pysmb before import causes this run-time error.

Possible patch is following.

==================
diff --git a/usr/bin/system-config-printer b/usr/bin/system-config-printer
index 9148b88..3bf3c0b 100755
--- a/usr/bin/system-config-printer
+++ b/usr/bin/system-config-printer
@@ -23,6 +23,9 @@

 import sys
 sys.path.append("/usr/share/system-config-printer")
+import pysmb
+PYSMB_AVAILABLE=True
+
 # config is generated from config.py.in by configure
 import config

@@ -77,11 +80,11 @@ import cups
 cups.require ("1.9.46")
 cups.ppdSetConformance (cups.PPD_CONFORM_RELAXED)

#624103#10
Date:
2011-04-25 15:29:36 UTC
From:
To:
So it is a minor bug.