2
$\begingroup$

I have been working on a project and I have been using JSON to build some networks, the code I use is:

Remove["Global`*"]
SetDirectory@NotebookDirectory[];
data = Import["DATASET.json", "JSON", Path -> NotebookDirectory[]];
data = Normal[data];

Suddenly it started to show an error that I haven't been able to fix:

Get::noopen: Cannot open JSONTools`. >>

Import::fmterr: Cannot import data as JSON format. >>

I have tried:

  • Closing and opening Mathematica
  • Making a clean start
  • Executing the following line trying to reset whatever is wrong: titanic = ExampleData[{"Dataset", "Titanic"}]
  • Restarting the PC

I am using a MAC OS 10.7.5 Mathematica Version 10.0.1.0

Thanks in advance


Guys thanks both for the help, after trying all your suggestions I have fixed it but still I wanted to answer all the questions for everyone to know:

Have you ensured that no notebooks or palettes are open, other than the notebook you are working with? A/ Yes indeed, the nb I was working with was the only one open and no palettes were open.

Did you try to evaluate this in a new and clean notebook (not an old one you saved)? A/ Yes I did try this, but the error persisted.

What does FindFile["JSONTools`"] return?

A/ "/Applications/Mathematica.app/SystemFiles/Links/JSONTools/Kernel/init.m"

Finally, just in case, try turning off the Suggestion Bar (go to Preferences, Interface tab, look at the bottom), restart Mathematica again and try again. A/ I did try this and restarted Mathematica and still not working.

Get[FindFile["JSONTools`"]]

This totally worked for the current session... When I restart Mathematica and try to import the JSON file it doesn't work. I have (As ZachB suggested) to use Get FindFile again everytime in order to make it work, I will attach to this solution by now.

Thanks for the help!

$\endgroup$
  • 1
    $\begingroup$ In addition to restarting Mathematica, have you ensured that no notebooks or palettes are open, other than the notebook you are working with? Did you try to evaluate this in a new and clean notebook (not an old one you saved)? What does FindFile["JSONTools`"] return? Finally, just in case, try turning off the Suggestion Bar (go to Preferences, Interface tab, look at the bottom), restart Mathematica again and try again. Let us know if it works now and which step fixed it. $\endgroup$ – Szabolcs Feb 12 '15 at 22:46
  • $\begingroup$ I edited your follow-up into the question for you. If you register your user account you will be able to edit your questions as intended. $\endgroup$ – Mr.Wizard Feb 13 '15 at 13:52
2
$\begingroup$

That's a funny bug that I would report to Wolfram. I managed to similarly break my environment by trying to answer this :-p. However, functionality is restored for the current session if you run

Get[FindFile["JSONTools`"]]

Unfortunately I seem to need to run this whenever I restart the kernel.

$\endgroup$
  • 1
    $\begingroup$ Have you tried my suggestions form the comment, in particular about the suggestions bar? Are you certain you need both FindFile and Get? $\endgroup$ – Szabolcs Feb 13 '15 at 3:04
  • $\begingroup$ Yeah, unfortunately just using FindFile isn't loading it into the context. I also tried loading System`Convert`JSONDump, which didn't help. $\endgroup$ – ZachB Feb 13 '15 at 19:38
  • $\begingroup$ FindFile doesn't load files, Get does ... did you mean to say that Get isn't loading it? $\endgroup$ – Szabolcs Feb 13 '15 at 19:47
  • $\begingroup$ Er, meant that evaluating a symbol from that context didn't fix the problem. $\endgroup$ – ZachB Feb 13 '15 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.