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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Matt Riedemann-3
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.

--

Thanks,

Matt

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [hidden email]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Reply | Threaded
Open this post in threaded view
|

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

Matt Riedemann-3
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

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [hidden email]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Reply | Threaded
Open this post in threaded view
|

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

Trinh Nguyen
Hi Matt,

Thanks for fixing the upgrade checker patch on Searchlight [1]. It works.


On Tue, Nov 6, 2018 at 11:28 PM Matt Riedemann <[hidden email]> wrote:
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

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: OpenStack-dev-request@...?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


--
Trinh Nguyen


__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: [hidden email]?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev