Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Trouble Loading Packages...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128337] Re: Trouble Loading Packages...
  • From: awnl <awnl at gmx-topmail.de>
  • Date: Mon, 8 Oct 2012 02:30:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k4lvf6$d39$1@smc.vnet.net>

Hello Richard,

> Here is the relevant code
>
>
> In[1]:= Directory[]
> Out[1]= "C:\\Users\\Richard\\Documents"
>
> FileNames[{"*.m"}]
> {"cellNeighbours.m", "myS.m"}
>
> FileExistsQ["cellNeighbours.m"]
> True
>
> In[5]:= FindFile["cellNeighbours.m"]
> Out[5]= "C:\\Users\\Richard\\Documents\\cellNeighbours.m"
> In[6]:= << cellNeighbours`

FindFile with only one argument uses the variable $Path to determine 
which directories to search in, and so does Get (<< is a short for for 
Get) and Needs. If you don't have changed it, $Path will usually contain 
an entry "." which is expanded to the current working directory which is 
what Directory[] returns. So, as FindFile finds the file so will Get -- 
and it indeed does, otherwise you'd get an error message when evaluating 
<< cellNeighbours` (something like "Get::noopen: Cannot open 
cellNeighbours`" ).

> In[7]:= ?cellNeighbours
> During evaluation of In[7]:= Information::notfound: Symbol cellNeighbours
> not found. >>

> Needs["cellNeighbours`"]
> Needs::nocont: Context cellNeighbours` was not created when Needs was
> evaluated. >>

the problem both of these messages indicate (if there are no others...) 
is that the package file does not contain what you expect. You can use
FilePrint["C:\\Users\\Richard\\Documents\\cellNeighbours.m"]
to see what Mathematica is really reading. Your package content looks 
correct and loads without problems for me, so I suspect that this isn't 
really the content of the cellNeighbours.m that you are loading. There 
are several things that can go wrong, e.g. when you 'Save As' and choose 
package file without having set the cells containing the code to 
initialization cells Mathematica will save the code in those cells just 
as comments. I suspect that this or something similar has happend to 
your file...

> Same thing happens with the myS package.  Why can't if find and load the
> package?

from what you sent I'd conclude that it does find and load the package, 
but that the file doesn't exactly contain what you think...

hth,

albert



  • Prev by Date: Re: Integrating DiracDelta in Mathematica: how to suppress
  • Next by Date: Re: Integrating DiracDelta in Mathematica: how to suppress ConditionalExpression
  • Previous by thread: Re: Trouble Loading Packages...
  • Next by thread: Locator + EventHandler