Skip to content

Instantly share code, notes, and snippets.

@iarp
Last active April 14, 2026 20:27
Show Gist options
  • Select an option

  • Save iarp/37ecf7bc6690d95e1d95643d38c0da76 to your computer and use it in GitHub Desktop.

Select an option

Save iarp/37ecf7bc6690d95e1d95643d38c0da76 to your computer and use it in GitHub Desktop.
When moving from android to iphone and keeping Nextcloud as my calendar and contacts sync, hundreds of contacts would not sync.
import pathlib
# pip install vobject
import vobject
input_file = pathlib.Path("cache/contacts-bad.vcf")
output_file = pathlib.Path("cache/contacts-fixed.vcf")
with input_file.open() as input_fo, output_file.open('w', newline="") as output_fw:
for item in vobject.readComponents(input_fo):
output_fw.write(item.serialize())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment