Re: How to debug init.m?
- To: mathgroup at smc.vnet.net
- Subject: [mg92349] Re: How to debug init.m?
- From: Bob F <deepyogurt at gmail.com>
- Date: Sun, 28 Sep 2008 07:22:07 -0400 (EDT)
- References: <gbmps7$i91$1@smc.vnet.net>
On Sep 27, 8:24 pm, John Fultz <jfu... at wolfram.com> wrote: > I agree that Tech Support is being a little onerous here. Here's a tec= hnique > which ought to make debugging things much easier... > > First, with all of your settings in place, evaluate the following... > > Put[Options[$FrontEnd], > ToFileName[{$HomeDirectory}, "OldSettings.m"]]; > > Then restart the FE with clean preferences. And evaluate the following= ... > > TestOption[opt_] := ( > Print["Testing option ", First[opt]]; > Pause[3]; > SetOptions[$FrontEnd, opt]; > FrontEndTokenExecute["OpenHelpLink"]; > Pause[2]; > MathLink`CallFrontEnd[ > FrontEnd`NotebookClose[FrontEnd`DefaultHelpViewerNotebook[]]]); > Scan[TestOption, Get[ToFileName[{$HomeDirectory}, "OldSettings.m"]]]; > > This will iterate through each option one at a time, telling you which on= e it's > trying. Presumably, after one of the settings, it will crash. Just = keep an eye > on it and see which one it is. Feel free to reduce the time in the fir= st call > to Pause[] if you're an attentive and fast reader. > > Once finished, you can run the following to reset your settings to the wa= y they > were. > > SetOptions[$FrontEnd, > Get[ToFileName[{$HomeDirectory}, "OldSettings.m"]]] > > Or you could send me your init.m file and I can do it for you. > > Sincerely, > > John Fultz > jfu... at wolfram.com > User Interface Group > Wolfram Research, Inc. > Well, I did what John suggested and no luck. The funny thing is that after doing the shift-option_start_Mathematica, and running John's program, then exiting, the init.m file is exactly what it was before deleting the init.m file, but no crash during the running of John's program. But I exited Mathematica and restarted and now with the "rebuilt" init.m file from John's program, it crashes like it always has. I am suspecting that it is some combination of the lines in the init.m file, not just a single one. But the puzzling thing is why does it not crash after completing all the steps in John's program? I looked at the init.m file after John's program ran and it is the same before exiting Mathematica as it is when starting Mathematica and it crashing. So there seems to be something extra that happens during startup that is not done when running this program like this. One other tidbit that seems odd -- if I delete the init.m file entirely and startup Mathematica I get two errors (same thing repeated twice) about ToExpression::notstrbox: FEPrivate`FrontEndResourceString[GetFEKernelInit] is not a string or a box. ToExpression can only interpret strings or boxes as Mathematica input. Is this pertinent? They go away with the problematic init.m file in place. I don't recall ever seeing this error before. I do have a couple of kernel configurations in the problematic init.m file, but with deleting the init.m file, they are gone, so not sure why this error would be here, as with the empty init.m file there are none listed than the default "Local" and there does not seem to be anything bogus there (only thing set is "Kernel name" of "Local", "Automatically launch on front end startup" is checked, and "Basic Options" has "Local Machine" set and "Kernel program:" set to "MathKernel", and all other boxes are unchecked). Any other suggestions? -- nevermind -- Well, I think I have figured it out partly. The problem seems to occur even without my init.m file (just removed it entirely) and then start up Mathematica, then open the Option Inspector and set the "View" to "as text" (default is "alphabetically"), then open the Documentation Center and the "Internal self-test error" pops up but no crash. Will now give this info to Wolfram and see if they can tell me why that it would matter what mode Option Inspector was running in. Would people try this out and see if you also get an "Internal self-test" error or a crash?? If you do please let me know and I will pass this along to Wolfram as well. Thanks everyone -- will let you know what I find out from Wolfram. And thanks very much to John Fultz -- without his program would not have wandered into the real clue. One minor change I did make to his program was to print a number in addition to the option so I could quickly read the screen and know where it would crash, even though it never did. Here is the revised program if anyone is interested... ii = 1; TestOption[opt_] := (Print["Option #", ii, " -- Testing option ", First[opt]]; ii = ii + 1; Pause[1]; SetOptions[$FrontEnd, opt]; FrontEndTokenExecute["OpenHelpLink"]; Pause[1]; MathLink`CallFrontEnd[ FrontEnd`NotebookClose[FrontEnd`DefaultHelpViewerNotebook[]]]); Scan[TestOption, Get[ToFileName[{$HomeDirectory}, "Old-init.m"]]]; By the way, the 217 line init.m file ended up being 38 different options, so obviously several lines were needed for some options. -Bob