[Zope] tutorial script error

Jim Washington jwashin@vt.edu
Fri, 23 Nov 2001 22:50:38 -0500


Raymond Norton wrote:

>I am following the tutorial. When I attempt to add this script I get a
>syntax error on line 1. It doesn't like the quotes.
>
>Can anyone give me advice on this?
>
>## Script (Python) "calculateCompoundInterest"
>      ##parameters=principal, interest_rate, periods, years
>      ##
>      """
>      Calculate compounding interest.
>      """
>      i = interest_rate / periods
>      n = periods * years
>      return ((1 + i) ** n) * principal
>

The quotes are probably OK.  Not knowing exactly what you are seeing, I 
would suggest deleting the whitespace at the beginning of each line. 
 Python uses indentation in an intuitive way most of the time, but 
arbitrary indentation like above is a problem, however, and can give a 
"syntax error."

hth,

-- Jim Washington