Mailing List Archive

CcSelectorPlugin fails without Babel
Hello

Summary:
The CcSelectorPlugin produces an error message if Babel is not installed.

https://trac-hacks.org/wiki/CcSelectorPlugin

Background:

I have been using the CcSelectorPlugin for many years. Now I
re-installed my TRAC server (now with TRAC 1.6). Intentionally I decided
to install TRAC without Babel because we do not want multi-lingual support.

After installing CcSelectorPlugin (Version 0.3, TrackHacks Revision
18597, from Nov. 2023, installation via PIP) it presents the following
error when I click the "CC Selection" button:

Trac detected an internal error:
KeyError: 'dgettext'

The Python Traceback points to "site-packages/trac/util/translation.py".

Of course the solution is to install Babel, which will solve the problem.

Nevertheless IMHO either a plug-in should clearly state its dependencies
during installation (or during run-time or in the documentation). Best
of course would be would be, if the plug-in could run without Babel.
After all, Babel is just optional for TRAC.

Don't get me wrong. I do not complain or blame. I just want to avoid
that people remove this nice plug-in just because they are facing a
"mysterious" error and do not see the simply solution to install Babel.

Unfortunately I know only little about Python and nothing about Babel
and thus cannot offer a patch. Shall I file a bug report?

Best regards
Clemens




--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/2fdd8b15-4317-43fc-80a6-5f1a76fa28f3%40osypkamed.com.
Re: CcSelectorPlugin fails without Babel [ In reply to ]
Could you please post entire of the traceback?

Jun Omae <jun66j5@gmail.com> (?? ?)


On Sun, Mar 24, 2024 at 21:35 Clemens Feige <c.feige@osypkamed.com> wrote:

> Hello
>
> Summary:
> The CcSelectorPlugin produces an error message if Babel is not installed.
>
> https://trac-hacks.org/wiki/CcSelectorPlugin
>
> Background:
>
> I have been using the CcSelectorPlugin for many years. Now I
> re-installed my TRAC server (now with TRAC 1.6). Intentionally I decided
> to install TRAC without Babel because we do not want multi-lingual support.
>
> After installing CcSelectorPlugin (Version 0.3, TrackHacks Revision
> 18597, from Nov. 2023, installation via PIP) it presents the following
> error when I click the "CC Selection" button:
>
> Trac detected an internal error:
> KeyError: 'dgettext'
>
> The Python Traceback points to "site-packages/trac/util/translation.py".
>
> Of course the solution is to install Babel, which will solve the problem.
>
> Nevertheless IMHO either a plug-in should clearly state its dependencies
> during installation (or during run-time or in the documentation). Best
> of course would be would be, if the plug-in could run without Babel.
> After all, Babel is just optional for TRAC.
>
> Don't get me wrong. I do not complain or blame. I just want to avoid
> that people remove this nice plug-in just because they are facing a
> "mysterious" error and do not see the simply solution to install Babel.
>
> Unfortunately I know only little about Python and nothing about Babel
> and thus cannot offer a patch. Shall I file a bug report?
>
> Best regards
> Clemens
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAEVLMajYuNChMYv_KRtSxW32%3DgmsqdzT_9dYpgkimZi0GUj8Fw%40mail.gmail.com.
Re: CcSelectorPlugin fails without Babel [ In reply to ]
> On Sun, Mar 24, 2024 at 21:35 Clemens Feige <c.feige@osypkamed.com
> <mailto:c.feige@osypkamed.com>> wrote:
>
> Hello
>
> Summary:
> The CcSelectorPlugin produces an error message if Babel is not
> installed.
>
> https://trac-hacks.org/wiki/CcSelectorPlugin
> <https://trac-hacks.org/wiki/CcSelectorPlugin>
>
> Background:
>
> I have been using the CcSelectorPlugin for many years. Now I
> re-installed my TRAC server (now with TRAC 1.6). Intentionally I decided
> to install TRAC without Babel because we do not want multi-lingual
> support.
>
> After installing CcSelectorPlugin (Version 0.3, TrackHacks Revision
> 18597, from Nov. 2023, installation via PIP) it presents the following
> error when I click the "CC Selection" button:
>
> Trac detected an internal error:
> KeyError: 'dgettext'
>
> The Python Traceback points to "site-packages/trac/util/translation.py".
>
> Of course the solution is to install Babel, which will solve the
> problem.
>
> Nevertheless IMHO either a plug-in should clearly state its dependencies
> during installation (or during run-time or in the documentation). Best
> of course would be, if the plug-in could run without Babel.
> After all, Babel is just optional for TRAC.
>
> Don't get me wrong. I do not complain or blame. I just want to avoid
> that people remove this nice plug-in just because they are facing a
> "mysterious" error and do not see the simply solution to install Babel.
>
> Unfortunately I know only little about Python and nothing about Babel
> and thus cannot offer a patch. Shall I file a bug report?
>
> Best regards
> Clemens
>



> Jun Omae wrote on 24.03.2024 at 13:46:
>> Could you please post entire of the traceback?


Here is the traceback.

Python Traceback
File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py",
line 609, in dispatch_request dispatcher.dispatch(req)
File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py",
line 301, in dispatch raise e
File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py",
line 265, in dispatch output = chrome.render_template(req, template,
data, metadata)
File
"/data/trac/python/lib/python3.11/site-packages/trac/web/chrome.py",
line 1381, in render_template template, data =
self.prepare_template(req, filename, data, text,
File
"/data/trac/python/lib/python3.11/site-packages/trac/web/chrome.py",
line 1487, in prepare_template domain_functions =
translation.domain_functions(domain, symbols)
File
"/data/trac/python/lib/python3.11/site-packages/trac/util/translation.py",
line 92, in domain_functions return [_functions[s] for s in symbols]
File
"/data/trac/python/lib/python3.11/site-packages/trac/util/translation.py",
line 92, in <listcomp> return [_functions[s] for s in symbols]

One can also "simulate" the issue by temporarily renaming the babel
installation directory. See attached screen shot.

Clemens

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/ec1b02bf-7ce9-4639-b0b2-dba7386d508b%40osypkamed.com.
Re: CcSelectorPlugin fails without Babel [ In reply to ]
On 2024/03/25 17:08, Clemens Feige wrote:
> Here is the traceback.
>
> Python Traceback
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py", line 609, in dispatch_request
> dispatcher.dispatch(req)
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py", line 301, in dispatch
> raise e
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/main.py", line 265, in dispatch
> output = chrome.render_template(req, template, data, metadata)
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/chrome.py", line 1381, in render_template
> template, data = self.prepare_template(req, filename, data, text,
> File "/data/trac/python/lib/python3.11/site-packages/trac/web/chrome.py", line 1487, in prepare_template
> domain_functions = translation.domain_functions(domain, symbols)
> File "/data/trac/python/lib/python3.11/site-packages/trac/util/translation.py", line 92, in domain_functions
> return [_functions[s] for s in symbols]
> File "/data/trac/python/lib/python3.11/site-packages/trac/util/translation.py", line 92, in <listcomp>
> return [_functions[s] for s in symbols]
>
> One can also "simulate" the issue by temporarily renaming the babel
> installation directory. See attached screen shot.

Thanks for the feedback.

> Unfortunately I know only little about Python and nothing about Babel
> and thus cannot offer a patch. Shall I file a bug report?

That is an issue of Trac core since 1.4.x.
It is reproduced with Trac 1.4.4 and 1.6 without Babel.
Please report it to trac.edgewall.org/newticket.


$ python3.11 -m venv /dev/shm/trac-1.6
$ /dev/shm/trac-1.6/bin/pip install -q Trac~=1.6.0
$ /dev/shm/trac-1.6/bin/python
Python 3.11.8 (main, Feb 25 2024, 16:41:26) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'babel'
>>> import trac
>>> trac.__version__
'1.6'
>>> from trac.test import EnvironmentStub, MockRequest
>>> from trac.web.chrome import Chrome
>>> env = EnvironmentStub()
>>> req = MockRequest(env)
>>> chrome = Chrome(env)
>>> chrome.prepare_template(req, 'layout.html', {}, domain='messages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/dev/shm/trac-1.6/lib/python3.11/site-packages/trac/web/chrome.py", line 1487, in prepare_template
domain_functions = translation.domain_functions(domain, symbols)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/shm/trac-1.6/lib/python3.11/site-packages/trac/util/translation.py", line 92, in domain_functions
return [_functions[s] for s in symbols]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/dev/shm/trac-1.6/lib/python3.11/site-packages/trac/util/translation.py", line 92, in <listcomp>
return [_functions[s] for s in symbols]
~~~~~~~~~~^^^
KeyError: 'dgettext'
>>>


$ virtualenv -p /usr/bin/python2.7 /dev/shm/trac-1.4
$ /dev/shm/trac-1.4/bin/pip install -q Trac~=1.4.0
$ /dev/shm/trac-1.4/bin/python
Python 2.7.18 (default, Jul 1 2022, 12:27:04)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named babel
>>> import trac
>>> trac.__version__
'1.4.4'
>>> from trac.test import EnvironmentStub, MockRequest
>>> from trac.web.chrome import Chrome
>>> env = EnvironmentStub()
>>> req = MockRequest(env)
>>> chrome = Chrome(env)
>>> chrome.prepare_template(req, 'layout.html', {}, domain='messages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/dev/shm/trac-1.4/lib/python2.7/site-packages/trac/web/chrome.py", line 1614, in prepare_template
domain_functions = translation.domain_functions(domain, symbols)
File "/dev/shm/trac-1.4/lib/python2.7/site-packages/trac/util/translation.py", line 92, in domain_functions
return [_functions[s] for s in symbols]
KeyError: 'dngettext'
>>>


--
Jun Omae <jun66j5@gmail.com> (?? ?)

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/a73e88de-c072-47c5-91b8-623ddd642ce4%40gmail.com.
Re: CcSelectorPlugin fails without Babel - #13745 Babel issue KeyError: 'dgettext' [ In reply to ]
> On Sun, Mar 24, 2024 at 21:35 Clemens wrote:
>
> Hello
>
> Summary:
> The CcSelectorPlugin produces an error message if Babel is not installed.
>
> https://trac-hacks.org/wiki/CcSelectorPlugin


Jun Omae wrote on 25.03.2024 at 11:31:
[snip]
>
> Thanks for the feedback.
>
[snip]
>
> That is an issue of Trac core since 1.4.x.
> It is reproduced with Trac 1.4.4 and 1.6 without Babel.
> Please report it to trac.edgewall.org/newticket.
>
[snip]

I created the ticket:

https://trac.edgewall.org/ticket/13745

Clemens

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/82ffa658-1c27-4f19-b44b-8002f1cf5dc1%40osypkamed.com.