python error when spss command not executed

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

python error when spss command not executed

mpirritano

All listers,

 

I’m running python externally. I’m getting a python error whenever an spss command in spss.Submit does not execute.

 

For example, if there is no variable name ‘varx’ when the spss.Submit has a delete variables varx in it I get an spss error and the command is not executed, but python also raises an error and does not complete the rest of the spss.Submit.

 

In the spss GUI  I can include something like this and it runs fine although it raises the error that there is not variable with this name. I have the same issue if I try to create a variable that is already there. SPSS raises an error and then python quits.

 

I want to allow for the possibility that a variable has been created already. I’d like to just be able to always include spss commands to create it. But it seems that if I do that python quits, and if I try to delete it first and it’s not there python quits.

 

Is there a way around this? Am I making an error or is this just how spss.Submit works in python.

 

Thanks

Matt

 

 

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648

 

Reply | Threaded
Open this post in threaded view
|

Re: python error when spss command not executed

Jon K Peck

Submit stops on an error.  You can use a try/except block to capture the exception and take appropriate action.

Hth,
Jon Peck
(From. ABQ)


  From: "Pirritano, Matthew" [[hidden email]]
  Sent: 02/14/2011 09:15 AM PST
  To: [hidden email]
  Subject: [SPSSX-L] python error when spss command not executed


All listers,

 

I’m running python externally. I’m getting a python error whenever an spss command in spss.Submit does not execute.

 

For example, if there is no variable name ‘varx’ when the spss.Submit has a delete variables varx in it I get an spss error and the command is not executed, but python also raises an error and does not complete the rest of the spss.Submit.

 

In the spss GUI  I can include something like this and it runs fine although it raises the error that there is not variable with this name. I have the same issue if I try to create a variable that is already there. SPSS raises an error and then python quits.

 

I want to allow for the possibility that a variable has been created already. I’d like to just be able to always include spss commands to create it. But it seems that if I do that python quits, and if I try to delete it first and it’s not there python quits.

 

Is there a way around this? Am I making an error or is this just how spss.Submit works in python.

 

Thanks

Matt

 

 

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648