Re: Package writing
- To: mathgroup at smc.vnet.net
- Subject: [mg67233] Re: Package writing
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Wed, 14 Jun 2006 06:28:34 -0400 (EDT)
- Organization: Uni Leipzig
- References: <e6lhqr$nfs$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, only one question .. *you* *changed* the *name* ?? You package define a context and this context it translated into a directory/filename, i.e. something like BeginPackage["This`Is`My`Package`"] EndPackage[] is searched as (somewhere $Path)/This/Is/My/Package.m There is a function ContextToFileName[] that does the translation. If you load a package that is found but it does not create the correct context you should get atleast a warning. So you can't "I chnaged the name of that file to DD.m" So a) What it the file name of the notebook ? b) What is the context of the package ? Regards Jens "marek" <MarekBr at gmail.com> schrieb im Newsbeitrag news:e6lhqr$nfs$1 at smc.vnet.net... | Hello All | I have the following problem. I used Template.nb to create a package. | During the whole process I had some problems trying to get it to work | although the same commands in a different (fresh/new notebook) produced | desired results. Right now the sutuation is as follows. I can use my | poackage if I load it into any notebook but it does not work in the | original notebook I used to write it. I have that notebook and the | associated m file in /home/marek/Mathematica/Packages. Here are first 4 | command I execute in the original notebook | 1. SetDirectory["/home/marek/Mathematica/Packages"] | This sets my working directory to the directory in which my package is | located. | 2. AppendTo[$Path, "/home/marek/Mathematica/Packages"]; | Here I append this very same directory to my search path so that I can | load that package in the same notebook for testing purposes. | 3. Needs["DataAnalysis`"] | This line loads that package. When I execute that line I get no | complaints form Mathematica that it cannot open something or anything | like that | After those there is a bunch of cells with the implementation of my | ppackage all of which are set to be an Initialization cells. | After them I have few cells which are using functions from my package | but they do not work. The symbols/functions defined in that package | seems to be recognized because Ctrl=k combination does the | autocomplition but nothing happens when I execute a cell with a funcion | defined in my package. | On the other hand I can copy my package to | /home/marek/.Mathematica/AutoLoad directory (and I do it changing the | name of that m file) and it works fine from there after I open new | notebook and load it with Needs["DD`"] (I chnaged the name of that file | to DD.m) | In a fresh notebook I can execute that AppendTo command from above and | then load my package from the original development directory (it has | different name there so I know that it is that version which is being | loaded not the one from /home/marek/.Mathematica/AutoLoad) and it will | work fine. | So why I cannot use my package from the original notebook I wrote it | in? | Any suggestiones greatly appreciated | Marek |