SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 


#Analytics
#SPSSStatistics
#Analyticstools
 View Only

Python & SPSS : SpssClient.StartClient() always starts a new, invisible instance (since SPSS 29)

  • 1.  Python & SPSS : SpssClient.StartClient() always starts a new, invisible instance (since SPSS 29)

    Posted 10/13/25 11:31 AM
    Edited by Joe Finger 10/13/25 02:13 PM

    Dear community,

    I'm very sorry. This is a duplicate post because my first post took almost 24 hours, so I thought it hadn't worked.

    Unfortunately, I don't know how to delete this post. 

    Best regards,
    Joe

    ****************************************

    Dear community,

    For years, we have been using a script that transfers SPSS syntax from Notepad++ to a running SPSS instance using Python. This worked perfectly up to and including version 28. At this point, we would like to express our sincere thanks to Remix4Dev.
    (--> https://github.com/Remix4Dev/npp-spss)

    Basically, a Python file is created and transferred to "statisticspython3.bat".

    Here is an example of such a Python file:

    #!/usr/bin/env python
    # -*- coding: windows-1252 -*- 
    import SpssClient 
    SpssClient.StartClient() 
    SpssClient.RunSyntax(r"""
    *Running spss code.
    get file "D:\test.sav".""")
    SpssClient.StopClient

    This no longer works since SPSS29. Even if a running SPSS instance exists, each "SpssClient.StartClient()" command starts a new, invisible instance.

    The Reference Guide states that the "StartClient Method
    Establishes a connection to the IBM SPSS Statistics client...If the script is run from an external Python process (such as a Python IDE or the Python interpreter),
    an attempt is made to connect to an existing IBM SPSS Statistics client."

    It seems that this is no longer the case with SPSS29, as the running SPSS instance is no longer accessed.

    Do you have any ideas or solutions for this, and is anyone else aware of this problem?

    It would be great if someone could help us.

    Best regards,
    Joe



    ------------------------------
    Joe Finger
    ------------------------------