farling42 / obsidian-import-json

Plug-in for Obsidian.md which will create Notes from JSON files
MIT License
91 stars 5 forks source link

Possible Bug: URL to JSON Data preventing Import of Local Files #74

Open Erallie opened 2 months ago

Erallie commented 2 months ago

The importer isn't doing anything when I press the "Import" button unless I specify an URL to the JSON data, even if I've chosen a JSON file in the previous entry. Because of this, I can't import JSON files from my local computer.

farling42 commented 2 months ago

Can you open the console of Obsidian's internal browser, and check the console for errors when you press the Import button

It can be opened on MS Windows with ctrl-shift-i

Erallie commented 2 months ago

First it said that it didn't have the proper permissions to read the selected file. So I ran it in administrator mode, and then this error occurred:

Uncaught (in promise) ReferenceError: Handlebars is not defined
    at eval (eval at <anonymous> (plugin:obsidian-import-json:1:1), <anonymous>:3:1)
    at JsonImport.eval (plugin:obsidian-import-json:12814:11)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-import-json:53:24)
farling42 commented 2 months ago

Urgh. It is probably best to sort out your file permissions so that you never need to run anything in administrator mode - the change of permissions will only make life more difficult for you in many unexpected situations.

I will check tomorrow to see if there are any changes in Obsidian.md which prevent Handlebars from still being accessible.

farling42 commented 2 months ago

The Handlebars package is provided as part of the Import JSON plugin, so there's no real reason that it shouldn't be defined when the plugin is running.

I can only assume it is something to do with running Obsidian as an administrator.

Erallie commented 2 months ago

How do I define the permissions so that I can import it without running administrator?

farling42 commented 2 months ago

It is likely something to do with how the files are stored on your computer.

The simplest way might be to use your O/S file browser to copy (not move) the file to another location. This should create a file which your account can normally read (you could try opening the file in the normal windows notepad too, to make sure that you can see the contents).

Erallie commented 2 months ago

I can already read the file in Visual Studio Code just by opening without going into administrator mode. It's only this plugin that is requiring administrator mode for me to read it.

Erallie commented 2 months ago

I just ran it outside of administrator mode, and it had the right permissions this time, but it produced the same error:

Uncaught (in promise) ReferenceError: Handlebars is not defined
    at eval (eval at <anonymous> (plugin:obsidian-import-json:1:1), <anonymous>:3:1)
    at JsonImport.eval (plugin:obsidian-import-json:12814:11)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-import-json:53:24)
farling42 commented 2 months ago

Just to check the plugin, could you remove it and then install it again - just in case something is wrong with the file?

farling42 commented 1 week ago

Could you check to see if version 0.37.1 fixes your issue?