Cannot find module grep

Bug #971551 reported by Tim Powell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bzr-grep
Fix Released
High
Jelmer Vernooij

Bug Description

I tried getting bzr-grep working with bzr 2.5. Following the instructions in the INSTALL file, I moved the directory to the plugins directory (renamed as grep).

bzr help grep works fine, so the files are in place.

However, actually trying to use the command causes this error:

bzr: ERROR: No module named grep
You may need to install this Python library separately.

I think this is caused by using lazy_import to get the grep module when it isn't a system module. It's a file in the plugin. I moved the import grep line in __init__.py outside the lazy_import call and all seems to be working now.

Prior to my change, bzr log gave this traceback:

0.083 looking for plugins in /usr/lib/python2.6/dist-packages/bzrlib/plugins
0.114 encoding stdout as sys.stdout encoding 'UTF-8'
0.115 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.131 Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 920, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 1131, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 695, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/commands.py", line 1148, in ignore_pipe
    result = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/bzrlib/plugins/grep/__init__.py", line 192, in run
    if not ignore_case and grep.is_fixed_string(pattern):
  File "/usr/lib/pymodules/python2.6/bzrlib/lazy_import.py", line 108, in __getattribute__
    obj = object.__getattribute__(self, '_resolve')()
  File "/usr/lib/pymodules/python2.6/bzrlib/lazy_import.py", line 85, in _resolve
    obj = factory(self, scope, name)
  File "/usr/lib/pymodules/python2.6/bzrlib/lazy_import.py", line 203, in _import
    module = __import__(module_python_path, scope, scope, [], level=0)
ImportError: No module named grep

0.131 return code 3

Revision history for this message
Martin Packman (gz) wrote :

What version of bzr-grep are you trying? For bzr 2.5 you need the fix for relative imports from r147.

Changed in bzr-grep:
status: New → Incomplete
Revision history for this message
Tim Powell (theuiguy) wrote :

I grabbed the tar from the main bzr-grep page. It says Latest version is 0.4.0-final.

After your comment, I pulled the trunk from launchpad and installed it again.

I confirm that bzr grep 0.5.0dev works as expected.

Thanks for the help!

Revision history for this message
Martin Packman (gz) wrote :

Great, I'm glad that worked for you. Seems like bzr-grep needs a new release.

Changed in bzr-grep:
assignee: nobody → Jelmer Vernooij (jelmer)
importance: Undecided → High
status: Incomplete → Fix Committed
Jelmer Vernooij (jelmer)
Changed in bzr-grep:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.