I use ubuntu 22.04. When I try run supertool from terminal, I receive an error:
Traceback (most recent call last):
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/SuperTool.py", line 1183, in execute
self.execute1(query)
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/SuperTool.py", line 1276, in execute1
for values in gramps_engine.get_values(self.trans, result):
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/SuperTool.py", line 767, in get_values
value, env = self.category.execute_func(
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/supertool_engine.py", line 746, in execute_person
return execute(dbstate, obj, code, PersonProxy, envvars, exectype)
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/supertool_engine.py", line 731, in execute
res = exec(code, env)
File "initial_statements", line 2, in <module>
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 117, in require_version
raise ValueError('Namespace %s is already loaded with version %s' %
ValueError: Namespace Gtk is already loaded with version 3.0
Traceback (most recent call last):
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/SuperTool.py", line 1183, in execute
self.execute1(query)
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/SuperTool.py", line 1276, in execute1
for values in gramps_engine.get_values(self.trans, result):
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/SuperTool.py", line 767, in get_values
value, env = self.category.execute_func(
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/supertool_engine.py", line 746, in execute_person
return execute(dbstate, obj, code, PersonProxy, envvars, exectype)
File "/home/yurii/.local/share/gramps/gramps52/plugins/SuperTool/supertool_engine.py", line 731, in execute
res = exec(code, env)
File "initial_statements", line 2, in <module>
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 117, in require_version
raise ValueError('Namespace %s is already loaded with version %s' %
ValueError: Namespace Gtk is already loaded with version 3.0
Looks like I have GTK versions conflict. I think Gramps uses another version then supertool. How can I fix this and dont break OS? Thanks
#!/bin/bash
# Get the current date and time
now=$(date +"%Y-%m-%d_%H-%M-%S")
echo "Run person names checker"
gramps -O "Main Tree" -a tool -p name=SuperTool,script=scripts/person_names_checker.script > "reports/person_names_checker_${now}.log" 2>&1
Which version of SuperTool? (Displayed in lower right corner when SuperTool is open in Gramps.)
BTW, I am asking for these clarifications because @kku will probably need the information to suggest a solution. This problem is beyond my experience with SuperTool.
/usr/local/lib/python3.10/dist-packages/gramps/gui/plug/_guioptions.py:43: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '4.0') before import to ensure that the right version gets loaded.
from gi.repository import Gtk
ERROR: Failed reading plugin registration SuperTool.gpr.py
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/gramps/gen/plug/_pluginreg.py", line 1380, in scan_dir
exec(
File "SuperTool.gpr.py", line 26, in <module>
File "/usr/local/lib/python3.10/dist-packages/gramps/gui/plug/__init__.py", line 31, in <module>
from ._guioptions import make_gui_option, add_gui_options
File "/usr/local/lib/python3.10/dist-packages/gramps/gui/plug/_guioptions.py", line 54, in <module>
from .. import widgets
File "/usr/local/lib/python3.10/dist-packages/gramps/gui/widgets/__init__.py", line 25, in <module>
from .buttons import *
File "/usr/local/lib/python3.10/dist-packages/gramps/gui/widgets/buttons.py", line 50, in <module>
class IconButton(Gtk.Button):
File "/usr/local/lib/python3.10/dist-packages/gramps/gui/widgets/buttons.py", line 51, in IconButton
def __init__(self, func, handle, icon="gtk-edit", size=Gtk.IconSize.MENU):
AttributeError: type object 'IconSize' has no attribute 'MENU'
2024-08-29 10:43:47.549: WARNING: _manager.py: line 329: Plugin error (from 'degreesofseparation'): Namespace Gtk is already loaded with version 4.0
2024-08-29 10:43:47.550: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
File "/usr/local/bin/gramps", line 3, in <module>
app.main()
File "/usr/local/lib/python3.10/dist-packages/gramps/grampsapp.py", line 686, in main
errors = run()
File "/usr/local/lib/python3.10/dist-packages/gramps/grampsapp.py", line 678, in run
startcli(error, argpars)
File "/usr/local/lib/python3.10/dist-packages/gramps/cli/grampscli.py", line 371, in startcli
climanager.do_reg_plugins(dbstate, uistate=None)
File "/usr/local/lib/python3.10/dist-packages/gramps/cli/grampscli.py", line 334, in do_reg_plugins
self._pmgr.reg_plugins(USER_PLUGINS, dbstate, uistate, load_on_reg=True)
File "/usr/local/lib/python3.10/dist-packages/gramps/gen/plug/_manager.py", line 230, in reg_plugins
r_class = getattr(mod, plugin.ruleclass)
AttributeError: 'NoneType' object has no attribute 'DegreesOfSeparation'
My guess is that this is because ‘gi.require_version(“3.0”)’ is not called when Gramps is run in the command line mode. There is such a call in gramps/gui/grampsgui.py but not in gramps/cli/grampscli.py.
Maybe you can try the following. The file /usr/bin/gramps contains
#!/usr/bin/python3 -O
import gramps.grampsapp as app
app.main()
Edit that file (or make a copy) so that it will contain
#!/usr/bin/python3 -O
import gi
gi.require_version("Gtk", "3.0")
import gramps.grampsapp as app
app.main()
This should force Gramps to use Gtk3 instead of Gtk4. This still does not explain why I could not reproduce…
As far as I understand Gramps uses and requires Gtk 3.0. It does not work with any other version.
Supertool itself does not specify any version. It relies on Gramps choosing the correct version (3.0).
It seems that in Ubuntu 22.04 the default Gtk version is 4.0. Therefore Gramps needs to specify the correct version (3.0). But it looks like it doesn’t (always?) do that if run in the command line mode.
I tried it now. The terminal supertool works good now. The issue is solved. But what I think, If Gramps has strict dependency of GTK version, maybe it should be added for all Gramps users in the future versions?