0

I want to import Xdp in the Gnome Builder python template called "GTK4 Application".

Adding this:

gi.require_version("Xdp", "1.0")
from gi.repository import Xdp

results into:

Traceback (most recent call last):
  File "/app/bin/python-test", line 45, in <module>
    from python_test import main
  File "/app/share/python-test/python_test/main.py", line 25, in <module>
    gi.require_version("Xdp", "1.0")
  File "/usr/lib/python3.11/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Xdp not available
Application exited

The strange thing is that require_version does work for Gtk and Adw just not for Xdp

If I run the same code in a venv it works fine.

3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Mar 25, 2024 at 8:16
  • Are you using flatpak? Commented Mar 26, 2024 at 17:36
  • Yes, I use flatpak. What I did was: 1. Create a new python "GTK4 Application" 2. Add the mentioned code to import Xdp 3. Hit run Commented Mar 27, 2024 at 18:47

1 Answer 1

0

Using flatpak you can only directly import modules that are part of the python core. Anything you need to install through pip needs to be installed as a module using the modules section of the flatpak application manifest. Here are detailed instructions on how to do this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.