Bug#796950: NameError: global name 're' is not defined

2015-08-29 Thread Lars Wirzenius
On Tue, Aug 25, 2015 at 10:31:59PM -0700, Diane Trout wrote:
> packages/obnamlib/plugins/exclude_pathnames_plugin.py", line 97, in
> compile_regexps
> except re.error as e:
> NameError: global name 're' is not defined

Thank you, this is now fixed in git and the fix will be included in
the next upload to Debian. Unfortunately, I had fixed it before I got
to your patch, so I didn't apply yours. However, I've added a credit
in the NEWS file for you.

-- 
sic transit disci mundi, ergo obnam



Bug#796950: NameError: global name 're' is not defined

2015-08-25 Thread Diane Trout
Package: obnam
Version: 1.15-1
Severity: grave
Justification: renders package unusable

Dear Maintainer,

I was attempting to run obnam backup and received the following python stack
trace.

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cliapp/app.py", line 189, in _run
self.process_args(args)
  File "/usr/lib/python2.7/dist-packages/obnamlib/app.py", line 206, in
process_args
self.hooks.call('config-loaded')
  File "/usr/lib/python2.7/dist-packages/obnamlib/hooks.py", line 188, in call
self.hooks[name].call_callbacks(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/obnamlib/hooks.py", line 65, in
call_callbacks
callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-
packages/obnamlib/plugins/exclude_pathnames_plugin.py", line 57, in
config_loaded
self.compile_exclusion_patterns()
  File "/usr/lib/python2.7/dist-
packages/obnamlib/plugins/exclude_pathnames_plugin.py", line 81, in
compile_exclusion_patterns
self.compile_regexps(regexps, self.pathname_excluder.exclude_regexp)
  File "/usr/lib/python2.7/dist-
packages/obnamlib/plugins/exclude_pathnames_plugin.py", line 97, in
compile_regexps
except re.error as e:
NameError: global name 're' is not defined

Looking at exclude_pathnames_plugin.py it does call "except re.error" and I
couldn't find a corresponding import re. So something seems wrong.

Attached are the modifications I made to exclude_pathnames_plugin in order to
get it to work.
--- /tmp/exclude_pathnames_plugin.py	2015-08-25 22:27:42.290914865 -0700
+++ /usr/lib/python2.7/dist-packages/obnamlib/plugins/exclude_pathnames_plugin.py	2015-08-25 22:27:13.923549566 -0700
@@ -18,8 +18,9 @@
 import logging
 import os
 import stat
 import time
+import re
 
 import obnamlib
 
 
@@ -93,11 +94,11 @@
 logging.debug('Regular expression: %s', regexp)
 try:
 compiler(regexp)
 except re.error as e:
-msg = ('error compiling regular expression "%s": %s' % (x, e))
+msg = ('error compiling regular expression "%s": %s' % (regexp, e))
 logging.error(msg)
-self.progress.error(msg)
+#self.progress.error(msg)
 
 def read_patterns_from_files(self, filenames):
 patterns = []
 for filename in filenames: