When I open mathematica, there will pop-up some messages
where
<< package`
is in the following file
FindFile["init.m"]
(*
C:\Users\HyperGroups\AppData\Roaming\Mathematica\Kernel\init.m
*)
package content in the package file:
BeginPackage["Test1`"]
Test1::usage = "";
Begin["`Private`"];
Nearest[{1, 2, 3, 5, 8, 5}, 5]
End[]
EndPackage[]
I've tried * Mathematica * 10.1@Windows and 10.0[without this problem]
Seems the problem is related with some special functions, like Nearest
Answer
Update
This has been fixed in a general way as of version 11.2.0. For more details, see this answer.
This is a known issue. It is not about package loading (or Nearest
) but about Catch
/Throw
not working correctly when used during kernel initialization. For example, just putting the following in init.m
Catch[Throw[1]]
will result in similar behavior. See also Arnoud Buzing's post here.
The workaround I've been using is to run any init code depending on Catch
/Throw
as a scheduled task, e.g.
task := Get["package`"];
RunScheduledTask[task, {1}]
Comments
Post a Comment