[openstack-dev] [goals][upgrade-checkers] FYI on "TypeError: Message objects do not support addition." errors

Matt Riedemann mriedemos at gmail.com
Tue Nov 6 14:28:19 UTC 2018


On 11/5/2018 10:43 AM, Matt Riedemann wrote:
> If you are seeing this error when implementing and running the upgrade 
> check command in your project:
> 
> Traceback (most recent call last):
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/oslo_upgradecheck/upgradecheck.py", 
> line 184, in main
>      return conf.command.action_fn()
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/oslo_upgradecheck/upgradecheck.py", 
> line 134, in check
>      print(t)
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", 
> line 237, in __str__
>      return self.__unicode__()
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", 
> line 243, in __unicode__
>      return self.get_string()
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", 
> line 995, in get_string
>      lines.append(self._stringify_header(options))
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", 
> line 1066, in _stringify_header
>      bits.append(" " * lpad + self._justify(fieldname, width, 
> self._align[field]) + " " * rpad)
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", 
> line 187, in _justify
>      return text + excess * " "
>    File 
> "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/oslo_i18n/_message.py", 
> line 230, in __add__
>      raise TypeError(msg)
> TypeError: Message objects do not support addition.
> 
> It is due to calling oslo_i18n.enable_lazy() somewhere in the command 
> import path. That should be removed from the project since lazy 
> translation is not supported in openstack and as an effort was abandoned 
> several years ago. It is probably still called in a lot of "big 
> tent/stackforge" projects because of initially copying it from the more 
> core projects. Anyway, just remove it.
> 
> I'm talking with the oslo team about deprecating that interface so 
> projects don't mistakenly use it and expect great things to happen.

If anyone is still running into this, require oslo.upgradecheck>=0.1.1 
to pick up this workaround:

https://review.openstack.org/#/c/615610/

-- 

Thanks,

Matt



More information about the OpenStack-dev mailing list