# Restoring 5.1 filters into 5.2

**URL:** <https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981>\
**Category:** Help\
**Tags:** data-recovery, bug-filed\
**Created:** [February 25, 2024, 7:44am UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981 "2024-02-25T07:44:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlynch](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@dlynch](https://gramps.discourse.group/u/dlynch)\
**Post date:** [February 25, 2024, 7:44am UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/1 "2024-02-25T07:44:41Z")

</div>

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?

 

```python
 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"))

```

 

```python
  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)

```

 

```python
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

---

<div class="post-metadata">

**Author:** ![Nick-Hall](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/nick-hall/32/95_2.png) [@Nick-Hall](https://gramps.discourse.group/u/Nick-Hall)\
**Post date:** [February 25, 2024, 3:39pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/2 "2024-02-25T15:39:48Z")

</div>

This looks like a bug introduced in commit [8b64b9f](https://github.com/gramps-project/gramps/commit/8b64b9f145c034bfca89c0efe7000562c8d84599).

See PR [#1383](https://github.com/gramps-project/gramps/pull/1383) - “Add the possibility to search sensitive/insensitive”.

---

<div class="post-metadata">

**Author:** ![dlynch](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@dlynch](https://gramps.discourse.group/u/dlynch)\
**Post date:** [February 25, 2024, 3:56pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/3 "2024-02-25T15:56:02Z")

</div>

Thank you. Do you want me to [submit a bug](https://www.gramps-project.org/wiki/index.php/Using_the_bug_tracker) report? Is there a work around that would allow me to move (most of) my filters?

David Lynch

---

<div class="post-metadata">

**Author:** ![Nick-Hall](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/nick-hall/32/95_2.png) [@Nick-Hall](https://gramps.discourse.group/u/Nick-Hall)\
**Post date:** [February 25, 2024, 5:18pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/4 "2024-02-25T17:18:34Z")

</div>

> [@dlynch](#):
>
> Do you want me to [submit a bug](https://www.gramps-project.org/wiki/index.php/Using_the_bug_tracker) report?

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.

---

<div class="post-metadata">

**Author:** ![dlynch](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@dlynch](https://gramps.discourse.group/u/dlynch)\
**Post date:** [February 25, 2024, 11:12pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/5 "2024-02-25T23:12:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nick-Hall](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/nick-hall/32/95_2.png) [@Nick-Hall](https://gramps.discourse.group/u/Nick-Hall)\
**Post date:** [February 25, 2024, 11:48pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/6 "2024-02-25T23:48:23Z")

</div>

Hopefully fixed in pull request [#1659](https://github.com/gramps-project/gramps/pull/1659).

---

<div class="post-metadata">

**Author:** ![AlfredKa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@AlfredKa](https://gramps.discourse.group/u/AlfredKa)\
**Post date:** [May 17, 2024, 2:14pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/9 "2024-05-17T14:14:57Z")

</div>

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](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981), but dont understand what steps need to be done to accomplish.

Any help is highly appreciated!

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [May 17, 2024, 3:53pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/10 "2024-05-17T15:53:17Z")

</div>

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 `gramps5` ~~`1`~~ `/custom_filters.xml` overtop the `gramps5``2``/custom_filters.xml` file.

However, the path for the [Gramps User Directory](https://www.gramps-project.org/wiki/index.php/Gramps_Glossary#user_directory) may be different. Your profile doesn’t say which OS you use. Windows definitely has a different path.

---

<div class="post-metadata">

**Author:** ![AlfredKa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@AlfredKa](https://gramps.discourse.group/u/AlfredKa)\
**Post date:** [May 17, 2024, 4:40pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/11 "2024-05-17T16:40:10Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [May 17, 2024, 4:54pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/12 "2024-05-17T16:54:40Z")

</div>

> [@AlfredKa](#):
>
> it is AppData in the user directory since I am windows 10

That’s true for the Gramps 5.1.x version. But the 5.2.2 User&nbsp;Directory is in `%``Local``AppData%`

---

<div class="post-metadata">

**Author:** ![AlfredKa](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@AlfredKa](https://gramps.discourse.group/u/AlfredKa)\
**Post date:** [May 18, 2024, 5:50pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/13 "2024-05-18T17:50:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [May 18, 2024, 6:11pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/14 "2024-05-18T18:11:04Z")

</div>

> [@AlfredKa](#):
>
> In my configuration both…

Now I have to do some tests! 😉

---

<div class="post-metadata">

**Author:** ![DaveSch](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesch/32/40_2.png) [@DaveSch](https://gramps.discourse.group/u/DaveSch)\
**Post date:** [May 18, 2024, 9:45pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/15 "2024-05-18T21:45:35Z")

</div>

> [@emyoulation](#):
>
> Now I have to do some tests!

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

> [@Installing Gramps 5.1.6 after 5.2.2 causes Gramps configuration confusion](https://gramps.discourse.group/t/installing-gramps-5-1-6-after-5-2-2-causes-gramps-configuration-confusion/5270/2):
>
> Gramps v5.2 will use the legacy directory layout if it detects an old installation. This makes upgrades easier.

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

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [May 18, 2024, 9:50pm UTC](https://gramps.discourse.group/t/restoring-5-1-filters-into-5-2/4981/16 "2024-05-18T21:50:14Z")

</div>

> [@DaveSch](#):
>
> 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
