Search code examples
pythonspss

SPSS Python Error


Getting the following error when trying to run SPSS from an external Python IDE.

import spss

yields the following error

Traceback (most recent call last):
  File "C:\Documents and Settings\USER\workspace\SPSS\src\NE ASQ 2010.py", line 6, in <module>
    import spss
  File "C:\Python26\Lib\site-packages\spss180\spss\spss.py", line 16, in <module>
    error = errCode()
  File "C:\Python26\Lib\site-packages\spss180\spss\errMsg.py", line 24, in __init__
    self.errMsg = errTable['okay'][str(0)]
KeyError: 'okay'

Ran the Python essentials plug-in with no errors. Funny thing is that I dont get an error when I run this in a syntax

BEGIN PROGRAM PYTHON.
import spss
num = spss.GetVariableCount()
print num
END PROGRAM.

Any help will be much appreciated.

Brock


Solution

  • I believe I figured out the issue. I needed to configure Eclipse to see the external python modules that are created when you install the SPSS/Python plugin. I had to set a reference to the modules when configuring the project.

    Once I did that, it looks like I am up and running!