Package: rednotebook
Version: 0.7.3-1
Severity: important
Tags: patch

If the ~/.rednotebook directory does not already exist, RedNotebook raises an
exception when trying to initialise logging:

Traceback (most recent call last):
  File "/usr/bin/rednotebook", line 7, in <module>
    import rednotebook.redNotebook
  File "/usr/share/rednotebook/rednotebook/redNotebook.py", line 55, in <module>
    filemode='w',
  File "/usr/lib/python2.5/logging/__init__.py", line 1240, in basicConfig
    hdlr = FileHandler(filename, mode)
  File "/usr/lib/python2.5/logging/__init__.py", line 770, in __init__
    stream = open(filename, mode)
IOError: [Errno 2] No such file or directory: 
'/home/jona/.rednotebook/rednotebook.log'

The attached patch checks at startup whether the directory exists, and creates
it if necessary just before loading the core redNotebook module.




-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages rednotebook depends on:
ii  python                        2.5.4-2    An interactive high-level object-o
ii  python-glade2                 2.14.1-3   GTK+ bindings: Glade support
ii  python-gobject                2.16.1-1   Python bindings for the GObject li
ii  python-gtk2                   2.14.1-3   Python bindings for the GTK+ widge
ii  python-support                1.0.3      automated rebuilding support for P
ii  python-yaml                   3.08-1     YAML parser and emitter for Python

rednotebook recommends no packages.

rednotebook suggests no packages.

-- no debconf information
--- rednotebook-0.7.3/rednotebook/rednotebook.old	2009-06-25 19:04:07.000000000 +0100
+++ rednotebook-0.7.3/rednotebook/rednotebook	2009-06-25 19:04:19.000000000 +0100
@@ -4,5 +4,12 @@
 import sys
 sys.path.insert(0, '/usr/lib/python2.5/site-packages')
 
+# if this is the first run, check the .rednotebook data directory is in place
+# so that logging can take place
+import os
+logDir = os.path.join(os.path.expanduser('~'), '.rednotebook')
+if not os.path.exists(logDir):
+        os.makedirs(logDir)
+
 import rednotebook.redNotebook
 rednotebook.redNotebook.main()

Reply via email to