I cannot run any bzr command anymore after having updating Python 2.7 to Python 3.5

# bzr               
 File "/usr/bin/bzr", line 49
except locale.Error, e:
                   ^ SyntaxError: invalid syntax

Looking around line 49, one finds:

enter image description here

LC_ALL is set to an empty string.


2 Answers 2


Line 49 is except locale.Error, e: and in you screenshot it reads: except locale.Erro-, e:

  • Changing - to r does not change anything
    – user123456
    Oct 7, 2016 at 16:56
  • It probably worked before I installed Python3
    – user123456
    Oct 7, 2016 at 17:00
  • oh, yes. Python3 has a different syntax for exception handling: except locale.Error as e:
    – Ron
    Oct 7, 2016 at 17:05

The error comes from the fact that Python uses another syntax for expeption

  • Python2.7: except locale.Error, e:
  • Python3: except locale.Error as e:

It is possible to change the expression but I prefered changing the first line of /usr/bin/bzr from #!/usr/bin/python to #!/usr/bin/python2.6 since my python command point to a +3.0 version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.