fgsanz
December 25, 2025, 5:52pm
1
What I’m trying to do
I am using the library py-obsidianmd and I have managed to write code to make changes to the metadata in YAML (frontmatter). The code runs and does not fail, but it does NOT write the changes to the markdown files (the notes). I cannot figure out the problem, I need help, PLEASE
Things I have tried
I have created a bug in GitHub with all the details:
opened 05:37PM - 25 Dec 25 UTC
Hi, please help me figure out this problem that I am facing. Thanks!
# The scen… ario
- I have files with FRONTMATTER metadata and a property called ```parent```
- Note that ```parent``` is a property of the kind ```List```
- I am filtering by all the notes that have two specific values, two note links in my vault, say ```[[NoteA]]``` and ```[[NoteB]]```
- Note that ```parent``` can have more values
- I want to remove ```[[NoteA]]``` linked notes, without touching the rest of the values of ```parent```
# The problem
- The command ```notes.write()``` does not fail but does not change the file.
- When I run the code, the timestamp of the filtered files **changes** but the content does not
# Example of a note's metadata
```
---
tags:
aliases:
date: 2025-09-22
week: "[[2025-W39]]"
time: 13:40
cssclasses:
number headings:
parent:
- "[[NoteA]]"
- "[[NoteB]]"
- "[[NoteC]]"
- "[[NoteD]]"
related:
people:
- "[[Bob]]"
- "[[Alice]]"
---
(the body of the note comes here)
```
# The code
```
from pyomd import Notes
from pyomd.metadata import MetadataType
from pathlib import Path
# 1. Location of the files
path = Path('/Users/fgs/Documents/Obsidian/TEST')
notes = Notes(path)
# 2. Filter the notes
notes.filter(has_meta=[
("parent", "[[NoteA]]", MetadataType.FRONTMATTER),
("parent", "[[NoteB]]", MetadataType.FRONTMATTER)
])
# 3. Use the library's built-in remove method on the collection
notes.metadata.remove(k="parent", l="[[NoteA]]", meta_type=MetadataType.FRONTMATTER)
# 4. Write all changes to disk
notes.write()
# 5. Done
print(f"Processed {len(notes.notes)} notes.")
```