Hello,
I'm a Python/SPSS (DANIWEB) beginner and I'm having a hard time getting classes, functions and methods into the right order. I want to write a script for SPSS where I can read text out of an text object from the SPSS-output file. My code looks like this:
import SpssClient
SpssClient.StartClient()
OutputDoc = SpssClient.GetDesignatedOutputDoc()
OutputItems = OutputDoc.GetOutputItems()
OutputDoc.ClearSelection()
for index in range(OutputItems.Size()):
OutputItems = OutputItems.GetItemAt(index)
text = OutputItems.GetTextContents()
if text.find(" Number of cases read: 0 Number of cases listed: 0") >= 0:
OutputItems.SetSelected(True)
SpssClient.StopClient()
print "fertig!"
OutputDoc.Delete()
error Message:
Traceback (most recent call last):
File "\\io\userdaten\EPIDEMIOLOGIE\Matthias\- Skripte\DingeEntfernen.py", line 11, in <module>
text = OutputItems.GetTextContents()
AttributeError: 'SpssClient.SpssOutputItem' object has no attribute 'GetTextContents'
I know that the I'm not using the "SpssOutputItem" Class inside my code. Why is it inside the error message?
The "GetTextContents" method is inside the "SpssLogItem" Class. How do I call these classes in the right way? I studied all the instructions but I can't get it right...
Could anyone help me please?