Re: fatal:syntax error: line -1 before or near .

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 18 2010 - 20:09:35 MDT

Mary,

Attached are simple test cases for C shell (csh) and Bourne shell
(sh). These demonstrate the problem for me with the following NCL
versions and platforms. The problem also occurred in previous NCL
versions:

    NCL 5.2.1 Mac OS 10.5.8
    NCL 5.2.1 Mac OS 10.6.4
    NCL 5.2.1 GNU/Linux (X86_64)

To run the demos:

   ./exit-test.csh < list1
   ./exit-test.sh < list1

These should run cleanly as is. To trigger the exit problem,
comment out the "exit" statement at the end of exit-test.ncl. I get
messages similar to Justin's:

   fatal:syntax error: line -1 before or near .
   etc.

--Dave

On 10/18/2010 3:06 PM, Mary Haley wrote:
> Hi Justin
>
> I'll open a ticket on this, because it's curious that you have to include
> an exit statement.
>
> Does somebody have a small test case that shows the problem?
>
> Dave gets all the kudos here for the work-around!
>
> --Mary
>
> On Oct 18, 2010, at 2:22 PM, Justin Traiteur wrote:
>
>> Dave,
>>
>> That fixed the problem! It is funny how a seemingly innocuous line
>> makes all the difference.
>>
>> thanks again,
>>
>> Justin
>>
>> Thank you too Mary!
>>
>>
>> On Oct 18, 2010, at 3:07 PM, Dave Allured wrote:
>>
>>> This reminds me of a quirk I have seen occasionally when using a
>>> shell script as a driver for an NCL script. NCL may continue
>>> reading from "standard in" past the end of the script, and start
>>> processing an input stream that belongs to the shell script, as if
>>> that stream was additional NCL statements.
>>>
>>> The workaround is to simply add an "exit" statement as the very last
>>> physical line of the NCL script. This forces NCL to terminate at
>>> the proper time.
>>>
>>> I do not know whether this quirk is active in the current version of
>>> NCL. HTH.
>>>
>>> --Dave A.
>>> NOAA/PSD/CIRES
>>>
>>> On 10/18/2010 9:39 AM, Mary Haley wrote:
>>>> Justin,
>>>>
>>>> I don't see any problems with your NCL script, but I don't
>>>> understand this command in your shell script:
>>>>
>>>> setenv ncl
>>>>
>>>> I don't think this will hurt anything, but it shouldn't be needed.
>>>>
>>>> The error message says:
>>>>
>>>> fatal:syntax error: line -1 before or near .
>>>> Sounding_200806011400_NN.
>>>>
>>>> but I don't see any reference to this name in your NCL script.
>>>>
>>>> Try removing the "setenv ncl" line, and running your shell script
>>>> up to the point where it's about to call "ncl Bayesian.ncl". Then
>>>> cd to where "Bayesian.ncl" is and type
>>>>
>>>> ncl Bayesian.ncl
>>>>
>>>> on the UNIX command line. It want to rule out that something is
>>>> going on with your shell script.
>>>>
>>>> --Mary
>>>>
>>>>
>>>> On Oct 18, 2010, at 7:52 AM, Justin Traiteur wrote:
>>>>
>>>>>
>>>>>>
>>>>>> Hey Everyone,
>>>>>>
>>>>>> I apologize for this posting being so long but I believe that I
>>>>>> must inform you on what this code is actually doing before trying
>>>>>> to debug. I am currently running the single column WRF model for
>>>>>> ensembles. The WRF is an idealized version needing only input
>>>>>> sounding and soil profiles. I have written an NCL script that
>>>>>> interpolates the 90 m wind speed and writes is to a file named
>>>>>> 'test.txt'. In order to do all of the ensembles I have written a
>>>>>> shell script that reads the sounding time and date from another
>>>>>> directory and injests it into the WRF. Then it calls the NCL
>>>>>> script to write the wind speed to a file to be concatenated
>>>>>> together at the end of the ensemble run. This all seems to make
>>>>>> logical sense but unfortunately I keep getting an error from the
>>>>>> NCL script. The error is:
>>>>>>
>>>>>> [jtraite2@manabe BAYESIAN]$ ./script_ensrun_MN_DY.csh
>>>>>> Doing Sounding_200806011300_NN.txt
>>>>>> starting wrf task 0 of 1
>>>>>> starting wrf task 0 of 1
>>>>>> Copyright (C) 1995-2010 - All Rights Reserved
>>>>>> University Corporation for Atmospheric Research
>>>>>> NCAR Command Language Version 5.2.0
>>>>>> The use of this software is governed by a License Agreement.
>>>>>> See http://www.ncl.ucar.edu/ for more details.
>>>>>> fatal:syntax error: line -1 before or near .
>>>>>> Sounding_200806011400_NN.
>>>>>> -------------------------------------^
>>>>>>
>>>>>> fatal:error in statement
>>>>>> fatal:syntax error: line 0 before or near .
>>>>>> Sounding_200806011500_NN.
>>>>>> -------------------------------------^
>>>>>>
>>>>>> fatal:error in statement
>>>>>> fatal:syntax error: line 1 before or near .
>>>>>> Sounding_200806011600_NN.
>>>>>> -------------------------------------^
>>>>>>
>>>>>> fatal:error in statement
>>>>>> fatal:syntax error: line 2 before or near .
>>>>>> Sounding_200806011700_NN.
>>>>>> -------------------------------------^
>>>>>>
>>>>>> fatal:error in statement
>>>>>> fatal:syntax error: line 3 before or near .
>>>>>> Sounding_200806011800_NN.
>>>>>> -------------------------------------^
>>>>>>
>>>>>> fatal:error in statement
>>>>>> fatal:syntax error: line 4 before or near .
>>>>>> Sounding_200806011900_NN.
>>>>>> -------------------------------------^
>>>>>>
>>>>>>
>>>>>>
>>>>>> My NCL script is as follows and is named Bayesian.ncl

<snip> (see original messages in archive)

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Mon Oct 18 20:09:40 2010

This archive was generated by hypermail 2.1.8 : Tue Oct 19 2010 - 14:38:00 MDT