Restoring 5.1 filters into 5.2

I have moved to 5.2.
I copied custom_filters.xml from gramps51 to gramp52: this has several hundred lines of my filters. I got the error below when I restarted gramps. Please, is there a way I can restore my 5.1 filters into 5.2?

 1680: ERROR: grampsapp.py: line 188: Unhandled exception
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.2.0\gramps\gui\grampsgui.py", line 768, in do_activate
    Gramps(self.argparser, self)
  File "C:\Program Files\GrampsAIO64-5.2.0\gramps\gui\grampsgui.py", line 574, in __init__
    self._vm = ViewManager(app, dbstate, config.get("interface.view-categories"))
  File "C:\Program Files\GrampsAIO64-5.2.0\gramps\gui\viewmanager.py", line 237, in __init__
    reload_custom_filters()
  File "C:\Program Files\GrampsAIO64-5.2.0\gramps\gen\filters\__init__.py", line 42, in reload_custom_filters
    CustomFilters.load()
  File "C:\Program Files\GrampsAIO64-5.2.0\gramps\gen\filters\_filterlist.py", line 112, in load
    parser.parse(the_file)
  File "AIO/xml/sax/expatreader.py", line 111, in parse
  File "AIO/xml/sax/xmlreader.py", line 125, in parse
  File "AIO/xml/sax/expatreader.py", line 217, in feed
  File "C:/M/B/src/Python-3.11.8/Modules/pyexpat.c", line 468, in EndElement
  File "AIO/xml/sax/expatreader.py", line 336, in end_element
  File "C:\Program Files\GrampsAIO64-5.2.0\gramps\gen\filters\_filterparser.py", line 149, in endElement
    rule = self.r(self.a, self.use_regex, self.use_case)
TypeError: HasCommonAncestorWithFilterMatch.__init__() takes from 2 to 3 positional arguments but 4 were given
David Lynch

GRAMPS: AIO64-5.2.0-r1-6167151
Python: 3.11.8
BSDDB: 6.2.9 (6, 0, 30)
sqlite: 3.45.1 (2.6.0)
LANG: en_GB.UTF-8
OS: Windows

This looks like a bug introduced in commit 8b64b9f.

See PR #1383 - “Add the possibility to search sensitive/insensitive”.

Thank you. Do you want me to submit a bug report? Is there a work around that would allow me to move (most of) my filters?

David Lynch

Yes please.

This is a bug in the HasCommonAncestorWithFilterMatch filter rule. It has not been updated to accept the extra argument which we pass it. A new filter cannot be created using this rule.

I suspect that the same problem may exist in other rules.

https://gramps-project.org/bugs/view.php?id=13187 submitted.

2 Likes

Hopefully fixed in pull request #1659.

1 Like

Actually I have made a lot of changes already after switching to gramps 5.2.2. Just now I realized, that all my filters from gramps 5.1 are gone. Actually when I reistall 5.1 and import an old backup (scheme 18) all my filters are available.

Any idea how I can migrate all my filters to the most recent tree in 5.2.2. I did read something in Restoring 5.1 filters into 5.2, but dont understand what steps need to be done to accomplish.

Any help is highly appreciated!

The custom filters are NOT stored in database. They are in a separate XML file.

The first step is to install any add-on Rules to your 5.2.2 installation.

If a Custom Filter uses a Rule that isn’t installed, then earlier version of Gramps would simply discard the Filter … with no alert. I’m unaware if 5.2.2 has changed this behavior. So installing add-on rules (including the ‘Generic’ ones that come with SuperTool) is a prophylactic measure.

If you’ve added any custom filters that you want to keep, you’ll have to manually splice the 5.1 filters into the 5.2 custom_filters.xml file.

Hopefully you haven’t created complex new filters and can just copy the old gramps51/custom_filters.xml overtop the gramps52/custom_filters.xml file.

However, the path for the Gramps User Directory may be different. Your profile doesn’t say which OS you use. Windows definitely has a different path.

Thanks a lot. I could identify the path - it is AppData in the user directory since I am windows 10. All addOns have been installed anyway, thus I just copied custom_filters.xml and it worked perfectly.

Thanks a lot for your quick help!

1 Like

That’s true for the Gramps 5.1.x version. But the 5.2.2 User Directory is in %LocalAppData%

In my configuration both gramps51 and gramps52 are in AppData\Roaming\gramps

Now I have to do some tests! :wink:

There is another thread that talks about where user files are created.

The short version is that if 5.2 is the first version you install on a computer %localappdata% is used. If older versions of Gramps have been installed %appdata% will still be used for 5.2

That’s make Gramps virtually impossible for tech support. I will object to that approach as loudly and as often as I can. (I accept that doing so is going to be ineffective and probably annoying. It is my personal opinion but please don’t take it personally.)

It is also why I objected strenuously to the change before 6.0