text: Greetings, <br>
  I recent ran some Python code and have encountered something strange (at
  least to me). I ran the following code in SPSS 16.0.1:
  //
  BEGIN PROGRAM PYTHON.
  import spss
  string1="DESCRIPTIVES VARIABLES="
  N=spss.GetVariableCount()
  scaleVarList=[]
  for i in xrange(N):
  if spss.GetVariableMeasurementLevel(i)=='scale':
  scaleVarList.append(spss.GetVariableName(i))
  string2="."
  spss.Submit() end program.
  //
  This code runs well on my machine, producing the expected output. But
  when I tested it out on my colleague's machine, to my surprise, it
  didn't work. It worked at least before the "for" loop, since I can
  print out the N correctly. I believe that the "if" statement is the
  issue, since the error message is about the empty variable list.
  I wonder if this is because that one of our installations is a newer
  installation, and there are at least two versions of the Python library
  SPSS, or it is something totally different? Could you give us some help
  on how to make Python run smoothly or how to figure out what is going
  on? We are puzzled by this inconsistency between machines. We are all
  running Windows XP, and they are up-to-date.
  Best regards,
  Christine
  Answer by SystemAdmin (532) | Apr 01, 2008 at 11:52 PM
  It's hard to read the code the way this got compressed here, but there should not be any version differences from machine to machine.<br>
  If you can post the actual error message with traceback, that might help. You could email the actual code to peck@spss.com or add it as an attachment.
  -Jon Peck
  45