Export TheBrain to Obsidian, a small script

Honestly I just followed @Sander notes on his GitHub page. The key is that you need python3 installed. Which it turns out my modern mac did.

1 Like

Thank you so much for this script! I am a newbie to Python but once I got that installed it worked flawlessly. very grateful

Do you know how to export only one Type of Thought from TB though? For example I have Organizations and Persons as types in TB and I would like to make the same distinction in Obsidian. Unfortunately it appears that I cannot make a selection before I press export. Any ideas?

Good to hear that it still works. But to be honest, it’s been quite a while since I looked into TheBrain (and my script) and I have no idea how to do what you want… :thinking:

Thanks I have solved it differently: in the newer versions of TB the type of thought is a thought in itself, so by using a program like atom.io I could find&replace the [[type of thought]] to a #typeofthought for 16,000 files at once :sunglasses:

Hey Hey, Thank you so much for this script. Sadly it stops working after some files at my end. It gives this error

OSError: [Errno 22] Invalid argument: ‘./obsidian/Um effektiver zu werden stoppe die Zeit fürs Geschirrspüler ausräumen (unter 2 min?).md’

Is there something i can do? I cant really programm and after a google search it seems that maybe the “?” symbol is causing the error? Thanks a lot for your help guys :slight_smile:

Could it be because of the ü Umlaut?
You could try renaming that thought in TheBrain and running the script again.

Yes, it has to do with funky characters in filenames. I had a similar problem with attachments of notes, which had a ? or a : in the filename. You can avoid this by renaming the attachments before exporting from the Brain.
There’s a little helper tool in the Brain under File->Utilities->Perform Data Integrity Scan. It will show all the files which should be renamed to a safe filename

This was a valuable tool. Thanks! I had a problem where a forgotten thought in my Brian data had a name that was hanging up the conversion. Fortunately, the error message in your script helped me find the thought in the JSON files using Atom, and I just deleted it. Everything fine after that!

1 Like

Hello,
I am trying to migrate my TheBrain instance to Obsidian starting with your tool but I have multiple thought with same name that are used to group external file by project like : requirement, specification, technical solution …
your tool is considering name of thought as the unique identifier then when each time another thought with same name is discovered, the replace previous one is replaced.
at the end from 380.000 thought from the brain, I only got 120.000 note which is note that good for me.
any idea I can update the script knowing that i have too many similar name to rename it manually from TB ?
regards

Great work! Hope someone will add it to the Obsidian Importer community plugin!

I can imagine it would be nice to have it up there, but it’s been almost four years since I wrote that script. I don’t have any Brains to convert anymore and I don’t want to upload a faulty script.
If anyone can test it and maybe even update it to cater for problems like thoughts with the same name, that would be awesome.