Day one to Obsidian conversion

Hello all,

Yet another day one converter, based off the work from quantum gardener (DayOne to Obsidian script).

Repository and instructions can be found here: GitHub - arnaudlimbourg/dayone-to-obsidian: Convert a DayOne JSON export into individual entries for Obsidian

I wanted to convert entries that had pdfs or png images. Converting multiple journals, a feature DayOne added at some point, was also on my list. As was having extra metadata like weather and user activity. One thing leading to another the code was updated and I figured it might interest someone.

Thanks QuantumGarderner!

6 Likes

Thanks a lot @arnaudl, and of course @dcb, for the starting point!

I was working on a similar script to help a (potential) migration from DayOne to Obsidian when I found this thread (and a few others) on the forum.

I adapted the script a bit and added two features (among others) that someone else might find useful:

  • Replacing DayOne internal links to Obsidian links. I have a journal where I heavily linked entries with each other, so migrating these links was essential to me.
  • Merging entries with the same date instead of creating a new file with a character suffix.

Repo is public on Github.

Hope it’s useful.

1 Like

Hi there, just wondering if you can assist me with this import from the JSON file to obsidian. I have no experience with Python and to be honest very little experience with executing anything via terminal. I have installed Python but don’t know how to run your script. Do you mind giving me a quick outline how to run this please? Appreciate your help and time. Cheers

Sure I can help you, perhaps I can record a short screencast on how to use the script. But I’m mostly using Linux and/or Mac OS, so if you’re a Windows user that’s slightly more complicated – well, I have a Windows machine at home, but I would have to install Python as I don’t use it that often.

Besides that, there are a few things that the script could do better. I already corrected a few small bugs but I discovered some more. For example (but it might not apply to your case): DayOne exports multi-line code blocks in a strange way, and I haven’t pushed that fix yet.

Hey thanks a lot! I use MacOS so a short screencast would be most helpful.

I’d really appreciate that mate

I tried to use this script but I just keep getting “ModuleNotFoundError: No module named ‘rich’”, though I have installed this module with pip. Is there something that I am missing? I am on macOS 12.3, with python 3.9.11 installed.

I have solved this problem by adding the rich module to the dependency section in the poetry toml file. :love_you_gesture:

Well, that’s actually a bug I accidentally introduced: I forgot to update the dependencies when I added a module of the “rich” package to print a progress bar (pretty useless, I’d say).

Thanks for spotting this!

1 Like

I had not checked that thread in a while.

Those are great improvements you brought @edobld, will add a note to my readme pointing to your version :slight_smile:

Anyone interested in an AWK approach, using jq for flattening the JSON file, have a look at

https://forum.obsidian.md/t/cli-scripts-for-importing-day-one-json/41136

or head straight to

https://github.com/0dB/dayone-json-to-obsidian

Thanks to the following

(from @edobld, @arnaudl, @dcb) that I “compared notes” with.

I will think about this. Currently I have decided to keep separate files, since I am also transferring the Day One metadata to the front matter in Obsidian, which includes location (which might change during the course of a day) and gives me context when reading my note.

If I change my mind about this, I can still write a script later that merges files. Obsidian is absolutely fantastic regarding doing all kinds of edits or moves or renames outside of Obsidian and handles that very gracefully.

Hey there!

I’m trying to use your script to migrate from DayOne to Obsidian, and when running the script I’ve been getting this error

Traceback (most recent call last):
  File "/Users/doug/Desktop/dayone-to-obsidian-main/import.py", line 165, in <module>
    convert()
  File "/Users/doug/Library/Caches/pypoetry/virtualenvs/migration-dayone-NbulI752-py3.11/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/doug/Library/Caches/pypoetry/virtualenvs/migration-dayone-NbulI752-py3.11/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/doug/Library/Caches/pypoetry/virtualenvs/migration-dayone-NbulI752-py3.11/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/doug/Library/Caches/pypoetry/virtualenvs/migration-dayone-NbulI752-py3.11/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/doug/Desktop/dayone-to-obsidian-main/import.py", line 143, in convert
    process_journal(
  File "/Users/doug/Desktop/dayone-to-obsidian-main/utils.py", line 239, in process_journal
    extra_tags=extra_tags,
               ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'extra_tags' where it is not associated with a value

I’m not super familiar with Python or working inside a terminal, so it’s likely that I’ve been doing something wrong! Any ideas what might be causing it? Any help is greatly appreciated :slight_smile:

Cheers!

Doug

1 Like

I’m trying to use your script to migrate from DayOne to Obsidian, and when running the script I’ve been getting this error

I got the same error. The fix is to open utils.py and the following lines after line 225:

        else:
            extra_tags = None

I would love to see a screencast on how to use this script. I know how to launch a python script, but I don’t know how to get this to work at all and I know I’m missing something.