How do I fix my syntax error?

Hey everyone,

I keep getting this syntax error and I don’t know how to fix it–can anyone help??

Traceback (most recent call last):

File “New_Script.py”, line 20, in ?

File “/Applications/Blender/blender.app/Contents/MacOS/.blender/scripts/groReadFile.py”, line 23

def readTheFile( "Volumes/Current/Ho_Roseanne/ChrisT/lpxa_md.gro", 100 ):

                                                                ^

SyntaxError: invalid syntax

New_Script.py is:

# blenderAni.py -   (Functions precede "main")
#
# getIpos:
#    Input:
#       thecoords  - the data values
#       numBeads  - the number of beads in the system.
#       numFrames - The number of frames to make the animation
#    Output:
#        ipoList - a list of ipos corresponding to the beads they will be attached to
#
#  "main":
#      the main part of this program does the bookkeeping, initializing the meshes, setting
#   variables, etc. it is also the caller of the other functions. Before this file is run, there should
#   be a sphere, probably in a different layer, named "Sphere" that will be cloned for the rest of
#   the spheres.


#<------------------------------------ "main" --------------------------------------------->
import Blender                                 # So we can manipulate spheres and such.
import groReadFile
from Blender import *

from groReadFile import readTheFile         # Our homemade file reader

#<------------------- constants --------->
filename = "Volumes/Current/Ho_Roseanne/Travis/groReadFile.py"
numFrames = 20
beadSize = 0.25


(coords, numbeads) = readTheFile( filename, numFrames )   # Get the data

sphMesh = NMesh.GetRaw("Sphere")         # The mesh that we put into the scene before we ran
                                         # the script, named "Sphere"
objs = []
for bead in range(0, numbeads):
                    
                            # Here we are putting the mesh into the scene, named "Bead.NNN"
   tempObj =  NMesh.PutRaw( sphMesh, "Bead."+`bead`, 1)
   tempObj.setSize( beadSize, beadSize, beadSize )

   tempIpo = Ipo.New('Object', 'ipo.'+`bead`)
   tempObj.setIpo( tempIpo )
  
   Locx = tempIpo.addCurve('LocX')          # add the skeleton curves X,Y,Z
   Locy = tempIpo.addCurve('LocY')
   Locz = tempIpo.addCurve('LocZ')

   for frame in range(0, numFrames):              #for each frame (Add the meat)
       Locx.addBezier( (frame,coords[frame][bead][0]) )
       Locy.addBezier( (frame,coords[frame][bead][1]) )
       Locz.addBezier( (frame,coords[frame][bead][2]) )
   #end frame

   objs.append( tempObj )
#end

and groReadFile.py is this:

# This is groReadFile.py.
#
# Input:
#   name - a valid filename. (There is no error checking, so if the
#          file doesn't exist, or the filename is wrong, it will
#          quit.
#
#   numframes - the number of frames. An integer, it can be all the
#               frames in the file, or just the first set.
#
# Output: (as a tuple which just glues them together so we can return
#          more than one thing.)
#    coords - a 3 dimentional array, structured as:
#                 coords[frame][bead][xyOrz]
#             so, coords[4][45][0] is the x coordinate of bead 45 in frame 4.
#             or, coords[0][0][2]  is the z coordinate of bead 1  in frame 1.
#     numbeads - the number of beads in the system
#
# Notes:
#    arrays use 0 as the first index, that is why above, coords[0] refers to the
#    first frame, and the first bead.

def readTheFile( "Volumes/Current/Ho_Roseanne/ChrisT/lpxa_md.gro", 100 ):
  
  # Declare variables
   x, y, z = [], [], []
   coords = []
   numbeads = 0

   infile = open( "Volumes/Current/Ho_Roseanne/ChrisT/lpxa_md.gro", "r" )                 # Open the file for reading
  
  
   for frame in range( 0, numframes ):
      l = infile.readline()        # Read header info ("Generated by...")
                                   # we don't care about this stuff.

      l = infile.readline()        # Read the number of beads
      numbeads = int( l )          # Each frame has the number
                                   # of beads in it as the first line
    
      bead = []
      for b in range( 0, numbeads ):
         data = (infile.readline()).split()  # read a data line, and split
                                             # it into a list of strings
                                
         # data is now a list of strings, the first element (data[0]) is the 3HISB
         # stuff. data[1] is your "nothing really" stuff, etc. x,y,z are at 3,4,5
         # respectively        
      
         bead.append( [float(data[3]), float(data[4]), float(data[5])] )
      #   x.append( float( data[3] ) )    # add it to our list of xs
      #   y.append( float( data[4] ) )    # "    "      "         ys
      #   z.append( float( data[5] ) )    # "    "      "         zs
      #end bead loop
  
      l = infile.readline()        #  a row of 6.00000's, not sure what for,
                                   # but didn't seem necessary.

      # Now, we add it to the coords array, which will be passed to
      # the next script for placement of the spheres.
      coords.append(bead)

    #  for i in range( 0, numbeads ):
    #    coords.append( [x[i], y[i], z[i]] )
      #end i loop

   #end frame loop

   # We are done with the file, so close it
   infile.close()

   return (coords, numbeads)   # return it

Sorry for this being really long-winded, but thanks in advance!!

Cheers!!

why did you put a colon at the end of that line?

[though, I haven’t check if that was the actual problem]

oh, I see, it is a function declaration

then why are you specifying actual values? you should be specifying the variables the values will be stored in, so like

def ReadTheFile(name, lines):
   # do nothing:
   pass

then call it with ReadTheFile("/home/nick/desktop/ieatbrains.txt",400) or something

I think he meant a default ie

def test(a, b=100):

LetterRip