[proFit-list] applescript-python-pro Fit problem

Chris Lee laserboy at fusemail.com
Thu Aug 28 08:15:41 CDT 2008


Hi All,
I am creating a program that will read netCDF files and find myself  
butting up against a strange problem.

The idea is that I read the file header and extract all the  
information about the variables and write this into a pro Fit data  
window (Each row is a separate variable). I then select the rows from  
the table that I am interested in and set the program in motion again  
to extract the data from each selected row and place them in data  
windows.

At the moment, the program creates the window and formats the columns  
appropriately, it then calls an applescript that analyzes a set of  
tags to determine if it is getting header info (in which case the user  
gets to select a file) or data and then calls a python script. The  
python script reads the netCDF file and then via the appscript module  
puts the appropriate data into a table.

Now, here is the thing... Each part works perfectly.
The program will make a new window, set all the tags correctly and  
call the applescript
the applescript gets the right file and starts the python script running
the python script will fill a table with data from a variable or  
header information, depending on how it is called... but... and this  
is the weird part. If the applescript is run from pro Fit it throws an  
error.


I can't understand why this should be the case.

I have included the scripts but note that you will need appscript,  
numpy, and pupynere installed for the python script to work. Also it  
expects to find python in a framework directory, not /usr/bin.

If you want to try the various parts separately you do the following:
put all the files in the same directory and load the pro Fit drawing  
file. Click the "Retrieve Header Info" button, this will let you  
select a netCDF file to load, open a data window and then fail. Now  
run the applescript from script editor and rechoose your netCDF file.  
This will now populate the pro Fit window with variable names.

now run the python script in a terminal window:
python <script_file_name> <netCDF_file_name> <variable_name>

this will open a new pro Fit data window and populate it with data  
from the variable. At the moment I have only tested it on 1-d variables.

Any advice on why the scripts work separately but not together would  
be appreciated.

Cheers
Chris



More information about the proFit-list mailing list