Package: cycle
Version: 0.3.1-1
Severity: grave

The program does not start at all:

$ cycle 
Traceback (most recent call last):
  File "/usr/bin/cycle", line 199, in ?
    app = MyApp(0)
  File
"/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 
7473, in __init__
    self._BootstrapApp()
  File
"/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 
7125, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/usr/bin/cycle", line 179, in OnInit
    ret=first_login()
  File "/mnt/local/usr/share/cycle/dialogs.py", line 304, in first_login
    users = get_users()
  File "/mnt/local/usr/share/cycle/dialogs.py", line 185, in get_users
    for f in files:
UnboundLocalError: local variable 'files' referenced before assignment


The problem seems to be a function that does not handle the case of an
empty variable. The attached patch which right shifts the whole file
accessing block one step seems to work. In case the file is not
accessible, the previously as empty initialized variable 'users' is
returned, so that should be safe, too. Be warned though, that I never
before edited a Python program :-)


Patch:

$ diff -u dialogs.py.orig dialogs.py
--- dialogs.py.orig     2005-10-28 01:04:58.879943811 +0200
+++ dialogs.py  2005-10-28 01:07:51.665012501 +0200
@@ -182,19 +182,19 @@
     p, f_name=get_f_name()
     if os.path.exists(p):
        files=os.listdir(p)
-    for f in files:
-       fd=open(os.path.join(p, f),"rb")
-       tmp=fd.read(len(magic_str))
-       if tmp == magic_str:
-           tmp=fd.read(100)
-           n=tmp.find("===") #find end string
-           if n <> -1:
-               users.append((cPickle.loads(tmp[:n]), f))
-       else: # old format, user_name=file_name
-           users.append((f,f))
-#    if not users:
-#      users=[(_('empty'),"empty")]
-    users.sort()
+        for f in files:
+            fd=open(os.path.join(p, f),"rb")
+            tmp=fd.read(len(magic_str))
+            if tmp == magic_str:
+                tmp=fd.read(100)
+                n=tmp.find("===") #find end string
+                if n <> -1:
+                    users.append((cPickle.loads(tmp[:n]), f))
+            else: # old format, user_name=file_name
+                users.append((f,f))
+#       if not users:
+#           users=[(_('empty'),"empty")]
+        users.sort()
     return users
 
 #---------------------------------------------------------------------------



bye,

-christian-


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-11-amd64-k8
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) (ignored: 
LC_ALL set to [EMAIL PROTECTED])

Versions of packages cycle depends on:
ii  python                        2.3.5-3    An interactive high-level object-o
ii  python-wxgtk2.6               2.6.1.2    wxWidgets Cross-platform C++ GUI t

cycle recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to