MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Package writing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67310] Re: Package writing
  • From: "marek" <MarekBr at gmail.com>
  • Date: Sun, 18 Jun 2006 05:12:46 -0400 (EDT)
  • References: <e6lhqr$nfs$1@smc.vnet.net><e6oorh$rr8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Jens

Yes I did change the name. Sorry I should have mentioned it in my
original post.
So here is a chain of actions I do
1. Open a file DataAnalysis.nb
2. Since I do not want to execute the initialization cells I just
execute those three cells I mentioned in the original post. As soon as
I try to execute the first cell
(SetDirectory["/home/marek/Mathematica/Packages"]) a little window pops
out asking me if I want to execute initialization cells? I say NO to
that and execute the remaining commands i.e
   a. AppendTo[$Path, "/home/marek/Mathematica/Packages"]
   b Needs["DataAnalysis`"]
3. then I scroll down past the initialization cells and try to execute
some commands which are using functiones defined in my package and they
do not work. The most intriguing think about all that is that the
autocomplition command works for all the functions defined in my
package so it looks like the package was detected and parsed ok.

Thanks for your reply

Marek

Jens-Peer Kuska wrote:
> 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
> |


  • Prev by Date: Re: Mathematica bugs?
  • Next by Date: RE: 3D plots
  • Previous by thread: Re: Package writing
  • Next by thread: Re: Package writing