Subject: Re: ibus-speech-to-text engine fails to run (?)

From: Liliana Marie Prikler <[email-masked]>
Date: Fri, 03 Feb 2023 08:14:42 +0100

Am Donnerstag, dem 02.02.2023 um 19:46 +0000 schrieb Luis Felipe:
> Could it be that the speech-to-text engine is failing to run because
> it can't find the GTK 4.0 namespace through Gobject Introspection.
> For example, after being pointed to the following command by IBus STT
> developer
> (https://github.com/PhilippeRo/IBus-Speech-To-Text/discussions/7) I
> see the following error:
> 
> ~~~
> $ /gnu/store/HASH-ibus-speech-to-text-0.4.0/libexec/ibus-engine-stt -
> -gapplication-replace -g
> Traceback (most recent call last):
>   File "/gnu/store/87dgkps8sp1jb4z2w4m1dnp0zvnq050l-ibus-speech-to-
> text-0.4.0/share/ibus-stt/main.py", line 38, in <module>
>     from sttenginefactory import STTEngineFactory
>   File "/gnu/store/87dgkps8sp1jb4z2w4m1dnp0zvnq050l-ibus-speech-to-
> text-0.4.0/share/ibus-stt/sttenginefactory.py", line 26, in <module>
>     from sttengine import STTEngine
>   File "/gnu/store/87dgkps8sp1jb4z2w4m1dnp0zvnq050l-ibus-speech-to-
> text-0.4.0/share/ibus-stt/sttengine.py", line 29, in <module>
>     gi.require_version('Gtk', '4.0')
>   File "/gnu/store/5ijhwr127smgxrp5dls7dxnr9jwa4m8p-python-pygobject-
> 3.40.1/lib/python3.9/site-packages/gi/__init__.py", line 129, in
> require_version
>     raise ValueError('Namespace %s not available for version %s' %
> ValueError: Namespace Gtk not available for version 4.0
> ~~~
> 
> In the command above, HASH is the hash corresponding to `ibus-speech-
> to-text-0.4.0` in my user profile.
> 
> 
> ## WORKAROUND
> 
> The input method works after making sure `gtk` and `python-pygobject`
> are in the environment where `ibus-engine-stt` is run:
> 
> 1. Start an augmented shell:
> 
>    guix shell ibus-speech-to-text gtk python-pygobject
> 
> 2. Run `ibus-engine-stt` as follows (where HASH is the hash for ibus-
> speech-to-text-0.4.0 in the profile created for the shell in step
> one):
> 
>    /gnu/store/HASH-ibus-speech-to-text-0.4.0/libexec/ibus-engine-stt
> --gapplication-replace -g
> 
> After this, you should see INFO and DEBUG information printed out.
> You can now launch an application, place the caret in any text box,
> switch to speech-to-text input method, and start dictating to the
> machine. Selecting other languages in "IBus STT settings → General →
> Locale" also work (I tried dictating in English, Japanese and
> Spanish).
Since this workaround works for you, I am fairly certain that the
package is simply missing a wrapper for GI_TYPELIB_PATH.  IMHO we
should more generally add some code to handle that in glib-or-gtk-
build-system, but that'd be a core-updates change.

Cheers