SPSS 21 Python problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SPSS 21 Python problem

sharonb
Hi,

I'm currently testing SPSS 21, ready for an upgrade from SPSS 19 (both 64-bit Windows).

I've installed the SPSS 21 Python essentials plugin and tried to run a Python script we use at my organisation to create Stata and tab-delimited data files from SPSS .sav files and accompanying data dictionaries.

The Python script works fine in SPSS 19, but I'm getting the following error message in SPSS 21 (see below).  Can anyone point me in the right direction to fix this? I'm a Python beginner.

Thanks in advance,
sharonb

-------

Traceback (most recent call last):
  File "S:\sharonb\working_scripts\daproc5_scripts\june_2014_processing_stata_11_x64bit_st64_no_stataissue.py", line 539, in <module>
    conversion()
  File "S:\sharonb\working_scripts\daproc5_scripts\june_2014_processing_stata_11_x64bit_st64_no_stataissue.py", line 128, in conversion
    p = Popen ( strCmd )
  File "C:\Python27\lib\subprocess.py", line 709, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
>>>
Reply | Threaded
Open this post in threaded view
|

Re: SPSS 21 Python problem

Jon K Peck
The Python Popen documentation describes the first argument (the only one in your case) as

args should be a string, or a sequence of program arguments. The program to execute is normally the first item in the args sequence or the string if a string is given

It appears that the program to execute portion is wrong.  Put a print statement ahead of the Popen call
print args
to see what it is trying to run.  It may be that your code from V19 is pointing to the old Statistics executable.

Without knowing more about the code, you might want to consider a simple external mode approach that doesn't need the subprocess architecture unless you are trying to handle many simultaneous jobs.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        sharonb <[hidden email]>
To:        [hidden email]
Date:        04/07/2015 07:10 AM
Subject:        [SPSSX-L] SPSS 21 Python problem
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi,

I'm currently testing SPSS 21, ready for an upgrade from SPSS 19 (both
64-bit Windows).

I've installed the SPSS 21 Python essentials plugin and tried to run a
Python script we use at my organisation to create Stata and tab-delimited
data files from SPSS .sav files and accompanying data dictionaries.

The Python script works fine in SPSS 19, but I'm getting the following error
message in SPSS 21 (see below).  Can anyone point me in the right direction
to fix this? I'm a Python beginner.

Thanks in advance,
sharonb

-------

Traceback (most recent call last):
 File
"S:\sharonb\working_scripts\daproc5_scripts\june_2014_processing_stata_11_x64bit_st64_no_stataissue.py",
line 539, in <module>
   conversion()
 File
"S:\sharonb\working_scripts\daproc5_scripts\june_2014_processing_stata_11_x64bit_st64_no_stataissue.py",
line 128, in conversion
   p = Popen ( strCmd )
 File "C:\Python27\lib\subprocess.py", line 709, in __init__
   errread, errwrite)
 File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
   startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
>>>



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/SPSS-21-Python-problem-tp5729165.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD