package trouble
- To: mathgroup at smc.vnet.net
- Subject: [mg117901] package trouble
- From: Alexandru Chirvasitu <chirvasitua at gmail.com>
- Date: Sun, 3 Apr 2011 06:58:49 -0400 (EDT)
Hi, This is a very frustrating problem. I'd appreciate any help you can provide. I'm trying to write a package; this has happened several times, with several packages, but most recently, I tried a very simple one that was suggested on this forum a while back, actually, by another user with a very similar problem: BeginPackage["anything`"] definition::usage="blablabla";... Begin["`Private`"] functions End[] Protect[functions] EndPackage[] I made sure the cell is an Initialization Cell, and I changed the style to "code". I saved in an appropriate directory both as anything.nb and anything.m, and then tried to read in the package with <<anything` What I got as output was Notebook[{Cell[ BoxData[{RowBox[{"BeginPackage", "[", "\"anything`\"", "]"}], " ", RowBox[{RowBox[{RowBox[{RowBox[{"definition", "::", "usage"}], "=", "\"blablabla\""}], ";"}], "..."}], " ", RowBox[{"Begin", "[", "\"`Private`\"", "]"}], " ", "functions", " ", RowBox[{"End", "[", "]"}], " ", RowBox[{"Protect", "[", "functions", "]"}], " ", RowBox[{"EndPackage", "[", "]"}]}], "Code", InitializationCell -> True, CellChangeTimes -> {{3.51079*10^9, 3.51079*10^9}}]}, WindowSize -> {715, 559}, WindowMargins -> {{96, Automatic}, {4, Automatic}}, FrontEndVersion -> "8.0 for Microsoft Windows (32-bit) (November 7, 2010)", StyleDefinitions -> "Default.nb"] If I try Needs["anything`"] I first get Needs::nocont: Context a` was not created when Needs was evaluated. >> and then th same RowBox mess as above. Does anybody have any idea what's going on? I should say, it has worked a bunch of times, but I can't see any pattern to it: most of the times it behaves like this, and only very rarely, it will go through. I should mention this is Mathematica 8, and the system is Windows XP. The other thread on MathGroup that I was referring to is here: http://forums.wolfram.com/mathgroup/archive/1999/Mar/msg00051.html There is only one response, regarding the package having to have the same name as the context (which is the case here), and also the need for the cell to be initialization (which again, is the case here). Please help; I'm desperate here :). Thank you, Al