Welcome to iraf.net Friday, May 17 2024 @ 03:11 AM GMT


 Forum Index > Help Desk > Systems New Topic Post Reply
 script error!
   
FSBoyden
 08/20/2007 02:56PM (Read 3745 times)  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
Hi allHave a undefined local variable error, that i can't seem to pick up. Here is a piece of the script[code:1:7186235057]
# Sorting code to rename and sort fitfiles into lists.procedure dirsetup (fitfiles) # Define procedure# Define procedure variablesstring fitfiles {prompt="The fitfiles to be used"}
bool filernm = yes {prompt="Rename fitfiles"}
bool sortfls = yes {prompt="Sort fitfiles"}struct *fitlistbegin # Define script variables
int i
bool renm, sortfiles
string ffiles, ftfls, data, fits, fitf, filter, .....

data = ""
filter = ""

# Make sure the necessary packages are loaded
if (!defpac ("imutil")){
bye()
}
;

# Check for null value for fitfiles
fitf = fitfiles
if (fitf != ""){

# Check the extn of files for non-fitfiles
i = strlen (fitf)
if ((substr (fitf, i-4, i) != ".fits") || (substr (fitf, i-3, i) != ".fit")) {
print("Warning: Incorrect filetype - Scipping file")
}
else {

# Expand the fitfiles template into a text file list
renm = filernm
if (filernm) {
rename (fitf, "fits", field="extn")
}
ffiles = mktemp ("tmp$setup")
sections (fitf, option="fullname", > ffiles)
}
}
else {
print("No fitfiles defined")
}
;

# Check if have to sort files
sortfiles = sortfls
if (sortfiles) {

# Redirect
ERROR -> fitlist = ffiles # Create lists
....
....# Code that is missing is just to create the different imagelists # Scan through the fitlist
while (fscan (fitlist, fits) != EOF) {
...
...
}
;
# Code that is missing is just the sorting code into the different lists # Clean up
fitlist = ""
delete (ffiles, ver-, >& "dev$null")end
[/code:1:7186235057]The code is used to rename and sort through fits files. The error is :ERROR - undefined local varieble "ffiles"
"fitlist = ffiles"If someone could help me on this. To sort the problem I have gone as far as to rewrite the whole script. Deleted the unneseccary .par files in the uparm dir, and did a mkiraf.I suspect that I am missing somthing small.... Frown Please helpRegards
Pat

 
Profile Email
 Quote
fitz
 08/20/2007 02:56PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
Hi Pat,I don't know if it's just the code snippet you sent, but I think the error is in[code:1:f170b320a4] # Check the extn of files for non-fitfiles
i = strlen (fitf)
if ((substr (fitf, i-4, i) != ".fits") || (substr (fitf, i-3, i) != ".fit")) {
print("Warning: Incorrect filetype - Scipping file")
}
[/code:1:f170b320a4]The test should be '&&', otherwise this will always be true for .fits files and you'll see the warning, in which case ffiles is never set. The message basically means that the variable hasn't been set, only declared. Hope this helps.Cheers,
-Mike

 
Profile Email
 Quote
FSBoyden
 08/20/2007 02:56PM  
++++-
Regular Member

Status: offline


Registered: 06/07/2006
Posts: 95
Hi MikeI think that that is it!!! Oops! Will try it tomorow when I am at the office again. Still mess up the AND - OR statements and their uses. Always had a problem with them, "When to use which one, how, ....... etc."Thanx for the help. :wink: I am handing in for my masters at the end of Nov. Should figure out how going to get the package to you, if you would still like to have a copy. Should be done with the final mods by then.Enjoy!Regards
Pat

 
Profile Email
 Quote
   
Content generated in: 0.09 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login