Re: Re: Saving edited packages
- To: mathgroup at smc.vnet.net
- Subject: [mg6304] Re: [mg6264] Re: [mg6261] Saving edited packages
- From: "w.meeussen" <w.meeussen.vdmcc at vandemoortele.be>
- Date: Sat, 8 Mar 1997 00:26:27 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
At 09:49 6-03-97 -0500, Mario Sancho Graca wrote: >lompado at liger.uah.edu wrote: >> >> I'm having trouble saving a package after I edit it using version 3.0 >> (on a Windows '95 machine). It appears that every time I save the >> package, the entire body of the package gets commented out (i.e., (* >> --body of package--*) ) and subsequent attempts at loading the newly >> saved package are unsuccessful. The error message says that the >> "Context MyPackage` was not created when Needs was evaluated" where >> MyPackage is the name of the package. When I use $Packages to check >> my contexts, the package is not in the context list. >> I have been trying to save the newly edited package using the "Save as >> Special - Package Format" command in the file menu. Simply using >> "Save" in the file menu saves the package as a notebook. I can't find >> any references in the Mathematica book regarding the correct way to >> save an edited package (or a new package for that matter). >> Incidentally, once the package has been modified, I try to save it >> with the same name as the original. Mathematica seems to be happy >> with that though and simply queries as to whether I want to overwrite >> the old one. The packages (both old and new) reside in the >> .\Add-Ons\Applications directory and this directory is indicated in >> the $Path command when I run it. Finally, prior to editing (which >> entails modifying a couple of functions) the old package loads >> properly. >> Am I missing something here? Has anyone run into this problem or do >> you know of a reference that teaches one how to properly (re)save >> packages? >> >> Thanks in advance for your time and consideration. >> >> Regards, >> Artie >> University of Alabama in Huntsville >> Physics Department >> Optics Building, Room 201c >> Huntsville, Al 35899 >> >> Lompado at liger.uah.edu > > >Saving cells with the front end 'Save As Special... Package Format" (I >use Mathematica 3.0 For Students, on Windows 95) does encapsulate each >cell with comment characters (* *). The booklet "Getting Started with >Mathematica For Students Under Microsoft Windows", Appendix 'Import and >Export Capabilities' states that the Package Format is "an ASCII file >with all formatting information and text commented out, leaving >Mathematica commands stored in initialization cells.". This aims to >filter the typing done in the notebook in order for the kernel to read >the file. But it does not seem to work at the present time. One way that >I found to work was to save the notebook as a text file ("Save as >Special... Text") which will keep everything that was typed except the >Notebook commands eg Cell[]. My package would still not run because of >the way the front end in 3.0 handles the typing, e.g. with word-wrap and >caring about the syntax structure while the user types. I edited the >file with a text editor and deleted some newline characters in which >Mathematica got stuck. Then it worked. > The front end has been much improved relative to version 2, and it >seems that this and other problems are bugs which need to be corrected >with patches or with the future 3.1. > > >-- >Mario Sancho Graca > >Email: >mario_sancho.graca at virgin.net >M.S.Graca at Warwick.ac.uk > >University of Warwick >Department of Engineering >Coventry CV4 7AL >United Kingdom > > > > yes, creating packages scares me too. Roman Maeder's C:\Program Files\Mathematica3.0\AddOns\ExtraPackages\ ProgrammingInMathematica\Template.nb is an enormous help to do it right. One snag: make only the 'good' lines into initialisation cells. Then, Save As Special ... 'your_filename' followed with extension '.m' you have to give the extension '.m' yourself, or else it becomes '.nb' !! But, the satisfaction of a working package makes you forget the small discomfort of 'labour'. wouter, Dr. Wouter L. J. MEEUSSEN eu000949 at pophost.eunet.be w.meeussen.vdmcc at vandemoortele.be