[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with source() ?
From: |
John W. Eaton |
Subject: |
Problem with source() ? |
Date: |
Wed, 18 Nov 1998 11:06:39 -0600 (CST) |
On 18-Nov-1998, Daniel Friedman <address@hidden> wrote:
| While my original question hasn't yet been answered,
What hasn't been answered? If by original question you mean
Without adding the 'bar' directory to LOADPATH, since I need the bar
directory only once, is there a way to specify to octave where to
look for mstuff.m just one time?
Then I think the answer is to use source(). If the file may be in any
one of a number of directories (but none are listed in your LOADPATH)
and you just want to source the first one that is found, then
something like
source (file_in_path (FILE))
should do it. If file is called "foo.m", you have to say that. Just
using "foo" won't work, because source() doesn't append ".m".
| let's first clear
| up the problem I notice now with the patch applied--namely, the source
| command doesn't appear to work for me:
|
| shell-prompt> cat ./scr1.m
| eight = 8;
| shell-prompt> octave
| Octave, version 2.0.13 (i686-pc-linux-gnulibc1).
| Copyright (C) 1996, 1997, 1998 John W. Eaton.
| This is free software with ABSOLUTELY NO WARRANTY.
| For details, type `warranty'.
|
| octave:1> source("scr1")
| error: source: error sourcing file `scr1'
| error: evaluating index expression near line 1, column 1
| octave:1> source("./scr1")
| error: source: error sourcing file `./scr1'
| error: evaluating index expression near line 1, column 1
If you don't have a file called "./src1", then that looks right so
far.
| octave:1> source("./scr1.m")
| octave:2> scr1
| octave:3> eight
| eight = 8
| octave:4> quit
|
| It appears the source command just doesn't work at all for me. Maybe it
| never worked, just now I have the error message. So what's wrong?
It's not clear to me that the source command failed. To be sure, you
need to check to see if the variable `eight' exists after the call to
source, I think.
jwe