Notion-to-Obsidian-Converter
Notion-to-Obsidian-Converter copied to clipboard
Invalid path error
Sorry to pester you again :) I am getting the following error.
PS C:\Users\ DummyMe\Desktop\New folder> node main
Notion Export Path:
A
readline.js:1147
throw err;
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.readdirSync (fs.js:950:10)
at fixNotionExport (C:\Users\ DummyMe\Desktop\New folder\main.js:200:28)
at C:\Users\ DummyMe\Desktop\New folder\main.js:239:17
at Array.forEach (<anonymous>)
at fixNotionExport (C:\Users\ DummyMe\Desktop\New folder\main.js:238:14)
at C:\Users\ DummyMe\Desktop\New folder\main.js:11:17
at Interface._onLine (readline.js:327:5)
at Interface._line (readline.js:658:8)
at Interface._ttyWrite (readline.js:1003:14)
at ReadStream.onkeypress (readline.js:205:10) {
code: 'ERR_INVALID_ARG_TYPE'
}
PS. I ran the old main.js it worked fine (not the table linking, but ran)
Originally posted by @dummifiedme in https://github.com/connertennery/Notion-to-Obsidian-Converter/issues/11#issuecomment-719824597
The issue comes from csvDirectory
being undefined on line 200 before it's passed into correctCSVLinks
. This occurs because the CSV is referencing links that are not in a subdirectory and instead exist somewhere else within the whole export.
e.g. A/B/C/database.csv
references A/X/Y/file.md
Oh. But how can that be? I mean, any entry in a database is essentially a page.
@dummifiedme Every entry is a page, but that entry can reference a page anywhere else in your Notion workspace. The change for #10 only looked in the subdirectory. I just need to change it so it can reference things anywhere.
Are you sure about this? I thought every entry creates a page inside this database specifically. Even if you try to mention or [[]] a page, it is essentially a hyperlink in the title of the new pade thus created in the database.
Oh maybe! It is unable to read the hyperlinks in the title!!
@dummifiedme Yeah, I saw that it was null so it wasn't able to read the directory, hence the path is invalid error. I've made some changes to deal with that and handling there being nothing passed into the correctCSVLinks
function.
This runs on three different Notion exports without errors, so I hope it works okay, but I think there may be some slight errors. There are known issues in this. For example, there's the possibility of there being a comma within a field, which messes up the parsing. However, fields with commas are exported with double quotes around them so it shouldn't be too difficult to deal with in the future. I just don't have the time right now. I'm going to make a pull request for the code as is though, so if you want, you can try that out.
Please have a look at it. https://github.com/visualcurrent/Notion-2-Obsidan
It doesn't create a table from databases but creates links to the pages. It's not as refined as your output, but databases part, you can take some inspiration? if you have some time :)
@dummifiedme Sorry for the delay in this. I was hoping to cover it in an overhaul of the script but that never really became an option. Is this still an issue for you or can I close it?