bzr does not work together with python 2.7.13

Bug #1653002 reported by Stefan Husmann on 2016-12-28
This bug affects 4 people
Affects Status Importance Assigned to Milestone

Bug Description

Together with python 2.7.13 running plain bzr or checking out something ends in:

bzr: ERROR: exceptions.TypeError: first argument must be string or compiled pattern

Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/bzrlib/", line 930, in exception_to_return_code
return the_callable(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 1121, in run_bzr
ret = run(*run_argv)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 673, in run_argv_aliases
File "/usr/lib/python2.7/site-packages/bzrlib/", line 697, in run
return self._operation.run_simple(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 136, in run_simple
self.cleanups, self.func, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 166, in _do_with_cleanups
result = func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 1507, in run
File "/usr/lib/python2.7/site-packages/bzrlib/", line 367, in sprout
File "/usr/lib/python2.7/site-packages/bzrlib/", line 132, in run
self.cleanups, self.func, self, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 166, in _do_with_cleanups
result = func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 417, in _sprout
result_repo.fetch(source_repository, fetch_spec=fetch_spec)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 1268, in fetch
find_ghosts=find_ghosts, fetch_spec=fetch_spec)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 218, in write_locked
result = unbound(self, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 2585, in fetch
File "/usr/lib/python2.7/site-packages/bzrlib/", line 77, in __init__

Downgrading python to version 2.7.12 fixes the problem.
File "/usr/lib/python2.7/site-packages/bzrlib/", line 98, in __fetch
pb.update(gettext("Finding revisions"), 0, 2)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 40, in gettext
File "/usr/lib/python2.7/site-packages/bzrlib/", line 92, in install
_translations = install_translations(lang)
File "/usr/lib/python2.7/site-packages/bzrlib/", line 114, in install_translations
File "/usr/lib/python2.7/", line 554, in translation
t = _translations.setdefault(key, class_(fp))
File "/usr/lib/python2.7/", line 255, in __init__
File "/usr/lib/python2.7/", line 391, in _parse
self.plural = c2py(plural)
File "/usr/lib/python2.7/", line 177, in c2py
result, nexttok = _parse(_tokenize(plural))
File "/usr/lib/python2.7/", line 114, in _parse
nexttok = next(tokens)
File "/usr/lib/python2.7/", line 85, in _tokenize
for mo in re.finditer(_token_pattern, plural):
File "/usr/lib/python2.7/", line 190, in finditer
return _compile(pattern, flags).finditer(string)
File "/usr/lib/python2.7/", line 247, in _compile
raise TypeError, "first argument must be string or compiled pattern"
TypeError: first argument must be string or compiled pattern

Stefan Husmann (stefan-husmann) wrote :

Also tested with python 2.7.12, not Problem then. Both under Arch Linux.

Stefan Husmann (stefan-husmann) wrote :

Maybe it is related:
# locale

Stefan Husmann (stefan-husmann) wrote :

This bug report is not a duplicate of bug #1644003. 2.7.13 is not 2.7.12 and the workaround given there does not fix the problem.

YamashitaRen (lemaitre-dulotus) wrote :

Same bug with Python 2.7.13 and fr_FR.UTF-8 locale on Archlinux.

Peter Mattern (pmattern) wrote :

> Maybe it is related:

My findings on Arch Linux where are strongly suggesting it indeed is: LANG=de_DE.UTF-8 → problem is manifest as depicted above, LANG={C;en_US.UTF-8} → problem ceases.

Btw. this is another hint the issue is not a duplicate of bug #1644003 besides the findings are somewhat similar.

Vincent Ladeuil (vila) wrote :

@Peter: Your findings seem completely similar to bug bug #1644003

If the patch proposed there doesn't fix the issue /then/ please provide a reproducing recipe of your issue with that patch applied, leaving this bug marked as duplicate in the mean time to avoid paperwork

Stefan Husmann (stefan-husmann) wrote :

The fix in commit 6621 of the 2.7 series makes

Traceback (most recent call last):
  File "/usr/bin/bzr", line 74, in <module>
    import bzrlib
  File "/usr/lib/python2.7/site-packages/bzrlib/", line 131, in <module>
AttributeError: 'module' object has no attribute 'install_lazy_compile'
==> FEHLER: Fehler beim Aktualisieren der Kopie des bazaar bzr Repositoriums

Vincent Ladeuil (vila) wrote :

@Stefan: You already reported bug #1657238 as a different issue so, please, don't make it harder to track issues.

Biji (biji) wrote :

Also happen to bzr explorer using python 2.7.13, cant launch:

bzr: ERROR: exceptions.TypeError: first argument must be string or compiled pattern

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/bzrlib/", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)

Seems to work now, thanks.

Peter Mattern (pmattern) wrote :

Somehow I wasn't noticed about new messages in this issue and just kept setting an appropriate locale as workaround in the meantime.
The findings I made are definitely fixed by Arch Linux package bzr 2.7.0-*2* which is backporting
I still don't quite get why I could see the problem on Arch as of Python 2.7.13 only while 2.7.12 is affected in #1644003, probably some Debian patching. But I guess this doesn't really matter any more now.

Vincent Ladeuil (vila) wrote :

@Peter: 2.7.12-7 was indeed including the offending bits so -7 explains why you started encountering the issue with 2.7.13.

Thanks for the feedback !

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers