Troubleshooting Gramps paths and environmental variables

Problems with the configuration of Gramps “constants” can be tedious to troubleshoot.

Rather than pawing through the various screens where the constants can be configured and then painfully using a series of Gramps CLI commands to explore the constants, you can paste a small script into the built-in Python Eval gramplet.

Copy the following script by clicking the image copy icon in the upper left corner of the code listing. Then paste it into the Python Eval’s “Evaluation” text box and click the Apply button.

import os
import sys
from gramps.gen.const import *

# Get all uppercase variables from the current namespace
ENV = {
    name: value for name, value in locals().items()
    if name.isupper() and not name.startswith('_') and isinstance(value, str)
}

# Print each item in the dictionary, indicating if it's a hidden directory
for key, value in ENV.items():
    try:
        if os.path.isdir(value):
            if sys.platform.startswith('win'):
                import ctypes
                attrs = ctypes.windll.kernel32.GetFileAttributesW(value)
                hidden_status = "HIDDEN" if attrs != -1 and bool(attrs & 2) else "NOT HIDDEN"
            else:
                hidden_status = "HIDDEN" if os.path.basename(value).startswith('.') else "NOT HIDDEN"
            print(f"({hidden_status})    {key}  :    {value}")
        else:
            print(f"{key}  :    {value}     (NOT A DIRECTORY)")
    except Exception as e:
        print(f"{key}  :    {value}     (ERROR :    {str(e)})")

Source: by Perplexity.ai after several debugs

on Gramps 5.2.1 on Fedora for user DistrictSupport, applying the script returns the output:

VERSION  :    5.2.1     (NOT A DIRECTORY)
PROGRAM_NAME  :    Gramps     (NOT A DIRECTORY)
URL_HOMEPAGE  :    http://gramps-project.org/     (NOT A DIRECTORY)
URL_MAILINGLIST  :    http://sourceforge.net/mail/?group_id=25770     (NOT A DIRECTORY)
URL_BUGHOME  :    http://gramps-project.org/bugs     (NOT A DIRECTORY)
URL_BUGTRACKER  :    http://gramps-project.org/bugs/bug_report_page.php     (NOT A DIRECTORY)
URL_WIKISTRING  :    http://gramps-project.org/wiki/index.php?title=     (NOT A DIRECTORY)
URL_MANUAL_PAGE  :    Gramps_5.2_Wiki_Manual     (NOT A DIRECTORY)
URL_MANUAL_DATA  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed     (NOT A DIRECTORY)
URL_MANUAL_SECT1  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_1     (NOT A DIRECTORY)
URL_MANUAL_SECT2  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_2     (NOT A DIRECTORY)
URL_MANUAL_SECT3  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_3     (NOT A DIRECTORY)
WIKI_FAQ  :    FAQ     (NOT A DIRECTORY)
WIKI_KEYBINDINGS  :    Gramps_5.2_Wiki_Manual_-_Keybindings     (NOT A DIRECTORY)
WIKI_EXTRAPLUGINS  :    5.2_Addons     (NOT A DIRECTORY)
WIKI_EXTRAPLUGINS_RAWDATA  :    Plugins5.2&action=raw     (NOT A DIRECTORY)
APP_FAMTREE  :    x-directory/normal     (NOT A DIRECTORY)
APP_GRAMPS  :    application/x-gramps     (NOT A DIRECTORY)
APP_GRAMPS_XML  :    application/x-gramps-xml     (NOT A DIRECTORY)
APP_GEDCOM  :    application/x-gedcom     (NOT A DIRECTORY)
APP_GRAMPS_PKG  :    application/x-gramps-package     (NOT A DIRECTORY)
APP_GENEWEB  :    application/x-geneweb     (NOT A DIRECTORY)
(NOT HIDDEN)    USER_HOME  :    /home/districtsupport
(HIDDEN)    HOME_DIR  :    /home/districtsupport/.gramps
(HIDDEN)    ORIG_HOME_DIR  :    /home/districtsupport/.gramps
(HIDDEN)    USER_DATA  :    /home/districtsupport/.gramps
(HIDDEN)    USER_CONFIG  :    /home/districtsupport/.gramps
(HIDDEN)    USER_CACHE  :    /home/districtsupport/.gramps
(NOT HIDDEN)    USER_PICTURES  :    /home/districtsupport/Pictures
VERSION_DIR_NAME  :    gramps52     (NOT A DIRECTORY)
(NOT HIDDEN)    VERSION_DIR  :    /home/districtsupport/.gramps/gramps52
(NOT HIDDEN)    USER_DATA_VERSION  :    /home/districtsupport/.gramps/gramps52
CUSTOM_FILTERS  :    /home/districtsupport/.gramps/gramps52/custom_filters.xml     (NOT A DIRECTORY)
REPORT_OPTIONS  :    /home/districtsupport/.gramps/report_options.xml     (NOT A DIRECTORY)
TOOL_OPTIONS  :    /home/districtsupport/.gramps/tool_options.xml     (NOT A DIRECTORY)
PLACE_FORMATS  :    /home/districtsupport/.gramps/place_formats.xml     (NOT A DIRECTORY)
(NOT HIDDEN)    THUMB_DIR  :    /home/districtsupport/.gramps/thumb
(NOT HIDDEN)    THUMB_NORMAL  :    /home/districtsupport/.gramps/thumb/normal
(NOT HIDDEN)    THUMB_LARGE  :    /home/districtsupport/.gramps/thumb/large
(NOT HIDDEN)    USER_PLUGINS  :    /home/districtsupport/.gramps/gramps52/plugins
(NOT HIDDEN)    USER_CSS  :    /home/districtsupport/.gramps/css
LIB_PATH  :    /home/districtsupport/.gramps/gramps52/plugins/lib     (NOT A DIRECTORY)
(NOT HIDDEN)    ROOT_DIR  :    /app/lib/python3.11/site-packages/gramps
(NOT HIDDEN)    GLADE_DIR  :    /app/lib/python3.11/site-packages/gramps/gui/glade
GLADE_FILE  :    /app/lib/python3.11/site-packages/gramps/gui/glade/gramps.glade     (NOT A DIRECTORY)
PERSON_GLADE  :    /app/lib/python3.11/site-packages/gramps/gui/glade/edit_person.glade     (NOT A DIRECTORY)
PLUGINS_GLADE  :    /app/lib/python3.11/site-packages/gramps/gui/glade/plugins.glade     (NOT A DIRECTORY)
MERGE_GLADE  :    /app/lib/python3.11/site-packages/gramps/gui/glade/mergedata.glade     (NOT A DIRECTORY)
RULE_GLADE  :    /app/lib/python3.11/site-packages/gramps/gui/glade/rule.glade     (NOT A DIRECTORY)
(NOT HIDDEN)    PLUGINS_DIR  :    /app/lib/python3.11/site-packages/gramps/plugins
(NOT HIDDEN)    DATA_DIR  :    /app/share/gramps
(NOT HIDDEN)    IMAGE_DIR  :    /app/share/gramps/images
TIP_DATA  :    /app/share/gramps/tips.xml     (NOT A DIRECTORY)
PAPERSIZE  :    /app/share/gramps/papersize.xml     (NOT A DIRECTORY)
ICON  :    /app/share/gramps/images/gramps.png     (NOT A DIRECTORY)
LOGO  :    /app/share/gramps/images/logo.png     (NOT A DIRECTORY)
SPLASH  :    /app/share/gramps/images/splash.jpg     (NOT A DIRECTORY)
LICENSE_FILE  :    /app/share/doc/gramps/COPYING     (NOT A DIRECTORY)
GTK_GETTEXT_DOMAIN  :    gtk30     (NOT A DIRECTORY)
COPYRIGHT_MSG  :    © 2001-2006 Donald N. Allingham
© 2007-2024 The Gramps Developers     (NOT A DIRECTORY)
COMMENTS  :    Gramps is a genealogy program that is both intuitive for hobbyists and feature-complete for professional genealogists.     (NOT A DIRECTORY)
AUTHORS_FILE  :    /app/share/gramps/authors.xml     (NOT A DIRECTORY)
XMLFILE  :    data.gramps     (NOT A DIRECTORY)
NO_SURNAME  :    (none)     (NOT A DIRECTORY)
NO_GIVEN  :    (none)     (NOT A DIRECTORY)
ARABIC_COMMA  :    ،     (NOT A DIRECTORY)
ARABIC_SEMICOLON  :    ؛     (NOT A DIRECTORY)
DOCGEN_OPTIONS  :    Docgen Options     (NOT A DIRECTORY)
COLON  :    :     (NOT A DIRECTORY)
SHORTOPTS  :    O:U:P:C:i:e:f:a:p:d:c:r:lLthuv?syqSD:     (NOT A DIRECTORY)

image on Gramps 5.2.1 on Windows 10 Pro for user my_username, applying the script returns the output:

VERSION  :    AIO64-5.2.1-r1-cdec38e     (NOT A DIRECTORY)
(NOT HIDDEN)    PROGRAM_NAME  :    Gramps
URL_HOMEPAGE  :    http://gramps-project.org/     (NOT A DIRECTORY)
URL_MAILINGLIST  :    http://sourceforge.net/mail/?group_id=25770     (NOT A DIRECTORY)
URL_BUGHOME  :    http://gramps-project.org/bugs     (NOT A DIRECTORY)
URL_BUGTRACKER  :    http://gramps-project.org/bugs/bug_report_page.php     (NOT A DIRECTORY)
URL_WIKISTRING  :    http://gramps-project.org/wiki/index.php?title=     (NOT A DIRECTORY)
URL_MANUAL_PAGE  :    Gramps_5.2_Wiki_Manual     (NOT A DIRECTORY)
URL_MANUAL_DATA  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed     (NOT A DIRECTORY)
URL_MANUAL_SECT1  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_1     (NOT A DIRECTORY)
URL_MANUAL_SECT2  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_2     (NOT A DIRECTORY)
URL_MANUAL_SECT3  :    Gramps_5.2_Wiki_Manual_-_Entering_and_editing_data:_detailed_-_part_3     (NOT A DIRECTORY)
WIKI_FAQ  :    FAQ     (NOT A DIRECTORY)
WIKI_KEYBINDINGS  :    Gramps_5.2_Wiki_Manual_-_Keybindings     (NOT A DIRECTORY)
WIKI_EXTRAPLUGINS  :    5.2_Addons     (NOT A DIRECTORY)
WIKI_EXTRAPLUGINS_RAWDATA  :    Plugins5.2&action=raw     (NOT A DIRECTORY)
APP_FAMTREE  :    x-directory/normal     (NOT A DIRECTORY)
APP_GRAMPS  :    application/x-gramps     (NOT A DIRECTORY)
APP_GRAMPS_XML  :    application/x-gramps-xml     (NOT A DIRECTORY)
APP_GEDCOM  :    application/x-gedcom     (NOT A DIRECTORY)
APP_GRAMPS_PKG  :    application/x-gramps-package     (NOT A DIRECTORY)
APP_GENEWEB  :    application/x-geneweb     (NOT A DIRECTORY)
(NOT HIDDEN)    USER_HOME  :    C:\Users\user
HOME_DIR  :    C:\Users\my_username\AppData\Roaming\gramps     (NOT A DIRECTORY)
ORIG_HOME_DIR  :    C:\Users\my_username\AppData\Roaming\gramps     (NOT A DIRECTORY)
(NOT HIDDEN)    USER_DATA  :    C:\Users\my_username\AppData\Local\gramps
(NOT HIDDEN)    USER_CONFIG  :    C:\Users\my_username\AppData\Local\gramps
(NOT HIDDEN)    USER_CACHE  :    C:\Users\my_username\AppData\Local\Microsoft\Windows\INetCache\gramps
(NOT HIDDEN)    USER_PICTURES  :    C:\Users\my_username\Pictures
VERSION_DIR_NAME  :    gramps52     (NOT A DIRECTORY)
(NOT HIDDEN)    VERSION_DIR  :    C:\Users\my_username\AppData\Local\gramps\gramps52
(NOT HIDDEN)    USER_DATA_VERSION  :    C:\Users\my_username\AppData\Local\gramps\gramps52
CUSTOM_FILTERS  :    C:\Users\my_username\AppData\Local\gramps\gramps52\custom_filters.xml     (NOT A DIRECTORY)
REPORT_OPTIONS  :    C:\Users\my_username\AppData\Local\gramps\report_options.xml     (NOT A DIRECTORY)
TOOL_OPTIONS  :    C:\Users\my_username\AppData\Local\gramps\tool_options.xml     (NOT A DIRECTORY)
PLACE_FORMATS  :    C:\Users\my_username\AppData\Local\gramps\place_formats.xml     (NOT A DIRECTORY)
(NOT HIDDEN)    THUMB_DIR  :    C:\Users\my_username\AppData\Local\Microsoft\Windows\INetCache\gramps\thumb
(NOT HIDDEN)    THUMB_NORMAL  :    C:\Users\my_username\AppData\Local\Microsoft\Windows\INetCache\gramps\thumb\normal
(NOT HIDDEN)    THUMB_LARGE  :    C:\Users\my_username\AppData\Local\Microsoft\Windows\INetCache\gramps\thumb\large
(NOT HIDDEN)    USER_PLUGINS  :    C:\Users\my_username\AppData\Local\gramps\gramps52\plugins
(NOT HIDDEN)    USER_CSS  :    C:\Users\my_username\AppData\Local\gramps\css
LIB_PATH  :    C:\Users\my_username\AppData\Local\gramps\gramps52\plugins\lib     (NOT A DIRECTORY)
(NOT HIDDEN)    ROOT_DIR  :    C:\Program Files\GrampsAIO64-5.2.1\gramps
(NOT HIDDEN)    GLADE_DIR  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\gui\glade
GLADE_FILE  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\gui\glade\gramps.glade     (NOT A DIRECTORY)
PERSON_GLADE  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\gui\glade\edit_person.glade     (NOT A DIRECTORY)
PLUGINS_GLADE  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\gui\glade\plugins.glade     (NOT A DIRECTORY)
MERGE_GLADE  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\gui\glade\mergedata.glade     (NOT A DIRECTORY)
RULE_GLADE  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\gui\glade\rule.glade     (NOT A DIRECTORY)
(NOT HIDDEN)    PLUGINS_DIR  :    C:\Program Files\GrampsAIO64-5.2.1\gramps\plugins
(NOT HIDDEN)    DATA_DIR  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps
(NOT HIDDEN)    IMAGE_DIR  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\images
TIP_DATA  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\tips.xml     (NOT A DIRECTORY)
PAPERSIZE  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\papersize.xml     (NOT A DIRECTORY)
ICON  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\images\gramps.png     (NOT A DIRECTORY)
LOGO  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\images\logo.png     (NOT A DIRECTORY)
SPLASH  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\images\splash.jpg     (NOT A DIRECTORY)
LICENSE_FILE  :    C:\Program Files\GrampsAIO64-5.2.1\share\doc\gramps\COPYING     (NOT A DIRECTORY)
GTK_GETTEXT_DOMAIN  :    gtk30     (NOT A DIRECTORY)
COPYRIGHT_MSG  :    © 2001-2006 Donald N. Allingham
© 2007-2024 The Gramps Developers     (NOT A DIRECTORY)
COMMENTS  :    Gramps is a genealogy program that is both intuitive for hobbyists and feature-complete for professional genealogists.     (NOT A DIRECTORY)
AUTHORS_FILE  :    C:\Program Files\GrampsAIO64-5.2.1\share\gramps\authors.xml     (NOT A DIRECTORY)
XMLFILE  :    data.gramps     (NOT A DIRECTORY)
NO_SURNAME  :    (none)     (NOT A DIRECTORY)
NO_GIVEN  :    (none)     (NOT A DIRECTORY)
ARABIC_COMMA  :    ،     (NOT A DIRECTORY)
ARABIC_SEMICOLON  :    ؛     (NOT A DIRECTORY)
DOCGEN_OPTIONS  :    Docgen Options     (NOT A DIRECTORY)
COLON  :    :     (NOT A DIRECTORY)
SHORTOPTS  :    O:U:P:C:i:e:f:a:p:d:c:r:lLthuv?syqSD:     (NOT A DIRECTORY)

image on Gramps 5.2.1 on macOS Sonoma for user macusername, applying a modified script returns the ENV output:

(NOT HIDDEN)    USER_HOME  :    /Users/macusername
(NOT HIDDEN)    USER_CACHE  :    /Users/macusername/Library/Application Support/gramps
(NOT HIDDEN)    USER_CONFIG  :    /Users/macusername/Library/Application Support/gramps
(NOT HIDDEN)    USER_DATA  :    /Users/macusername/Library/Application Support/gramps
VERSION  :    5.2.1     (NOT A DIRECTORY)
(NOT HIDDEN)    VERSION_DIR  :    /Users/macusername/Library/Application Support/gramps/gramps52
(NOT HIDDEN)    USER_DATA_VERSION  :    /Users/macusername/Library/Application Support/gramps/gramps52
(NOT HIDDEN)    THUMB_DIR  :    /Users/macusername/Library/Application Support/gramps/thumb
(NOT HIDDEN)    THUMB_NORMAL  :    /Users/macusername/Library/Application Support/gramps/thumb/normal
(NOT HIDDEN)    THUMB_LARGE  :    /Users/macusername/Library/Application Support/gramps/thumb/large
(NOT HIDDEN)    USER_PLUGINS  :    /Users/macusername/Library/Application Support/gramps/gramps52/plugins
(NOT HIDDEN)    ROOT_DIR  :    /Users/macusername/Applications/Gramps5.2.1.app/Contents/Resources/lib/python3.11/site-packages/gramps
(NOT HIDDEN)    GLADE_DIR  :    /Users/macusername/Applications/Gramps5.2.1.app/Contents/Resources/lib/python3.11/site-packages/gramps/gui/glade
(NOT HIDDEN)    PLUGINS_DIR  :    /Users/macusername/Applications/Gramps5.2.1.app/Contents/Resources/lib/python3.11/site-packages/gramps/plugins
(NOT HIDDEN)    DATA_DIR  :    /Users/macusername/Applications/Gramps5.2.1.app/Contents/Resources/share/gramps
(NOT HIDDEN)    IMAGE_DIR  :    /Users/macusername/Applications/Gramps5.2.1.app/Contents/Resources/share/gramps/images
1 Like

The script can be run from SuperTool (an addon tool by the Isotammi project) as well.

Just copy the code into the “Initialization statements” section in Supertool and press Execute. The output will appear on the console/terminal

(This means that you have to have started Gramps from the command line mode.)

The output could be more compact and digestable.
Nick notes that there are jsut 3 key library calls for the default base directories: