OpenSyntaxDoc Method (Python)

Opens the specified syntax document and makes it the designated syntax document. The method returns an SpssSyntaxDoc object. By default, the associated Syntax Editor window is invisible. Use the SetVisible method from the SpssSyntaxUI class to make the Syntax Editor window visible. You get an SpssSyntaxUI object using the GetSyntaxUI method of the SpssSyntaxDoc object.

Syntax

SpssSyntaxDoc=SpssClient.OpenSyntaxDoc(fileName,password=None)

Parameters

fileName. The path and file name of the syntax document, as a string.

password. A string that specifies the password that is required to open the file. This setting applies only to encrypted syntax files. The password can be specified as encrypted or unencrypted. For reference, passwords are always encrypted in pasted syntax.

Example

import SpssClient
SpssClient.StartClient()
syntaxDoc = SpssClient.OpenSyntaxDoc(r"fileName")
syntaxUI = syntaxDoc.GetSyntaxUI()
syntaxUI.SetVisible(True)
SpssClient.StopClient()

On Windows, it is recommended to use raw strings for file paths, or replace backslashes with forward slashes (IBM® SPSS® Statistics accepts a forward slash for any backslash in a file specification). Raw strings are specified by prefacing the string with r, as in r'c:\examples\mydata.sav'. In raw mode, Python treats all backslashes in the string as the backslash character and not as the start of an escape sequence.