Python question

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

Python question

Tim AT Home

Hi all,

 

I am not a Python guru by any means and I am having an issue that I hope I can get help with

I have a running instance of SPSS – with open ouptut and syntax documents (just one of each)

I run a simple Python program block within the running SPSS session

 

BEGIN PROGRAM PYTHON.

 

import sys

 

import spss #; help(spss)

 

sys.path.insert(0, r"C:\Work_Home\MergeDev")

 

import TWHV23MergeSigTest

 

TWHV23MergeSigTest.MergeRoutine()

 

END PROGRAM.

 

to format my output (this just deletes notes, warnings etc – essentially leaving just the tables) and this runs no problem.

 

 

Now I want to add within the TWHV23MergeSigTest python function a call to run a ‘sbs’ script.

(this is a pre 16 script I wrote that I figure wont run – but the first step is to try and run it and I cant do that).

I have tried the following syntax

 

    try:

 

        Submit(r"""

        SCRIPT "C:\Work_Home\MergeDev\TESTTIMHMergeTestingScriptV4.sbs".

        """)   

 

    except:

        raise

 

 

and I get an error identifying  Submit(r”””

NameError: global name ‘Submit’ is not defined

 

 

I am confused as to why I cant run Submit at this point?

 

 

 

 

 

 

 

 

Thanks!

 

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

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Python question

Jon K Peck
This line
        Submit(r"""
should be
        spss.Submit(...



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




From:        Tim Hennigar <[hidden email]>
To:        [hidden email]
Date:        06/01/2015 09:37 AM
Subject:        [SPSSX-L] Python question
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi all,
 
I am not a Python guru by any means and I am having an issue that I hope I can get help with
I have a running instance of SPSS – with open ouptut and syntax documents (just one of each)
I run a simple Python program block within the running SPSS session
 
BEGIN PROGRAM PYTHON.
 
import sys
 
import spss #; help(spss)
 
sys.path.insert(0, r"C:\Work_Home\MergeDev")
 
import TWHV23MergeSigTest
 
TWHV23MergeSigTest.MergeRoutine()
 
END PROGRAM.
 
to format my output (this just deletes notes, warnings etc – essentially leaving just the tables) and this runs no problem.
 
 
Now I want to add within the TWHV23MergeSigTest python function a call to run a ‘sbs’ script.
(this is a pre 16 script I wrote that I figure wont run – but the first step is to try and run it and I cant do that).
I have tried the following syntax
 
    try:
 
        Submit(r"""
        SCRIPT "C:\Work_Home\MergeDev\TESTTIMHMergeTestingScriptV4.sbs".
        """)    
 
    except:
        raise
 
 
and I get an error identifying  Submit(r”””
NameError: global name ‘Submit’ is not defined
 
 
I am confused as to why I cant run Submit at this point?
 
 
 
 
 
 
 
 
Thanks!
 
*********************************
Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.
 

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@... (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

Reply | Threaded
Open this post in threaded view
|

Re: Python question

Tim AT Home

 

 

Ahh  - the forest for trees – thank you!

 

 

 

Thanks!

 

[hidden email]

(W) 416-947-7807

(H)  905-987-3250

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

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

From: Jon K Peck [mailto:[hidden email]]
Sent: Monday, June 01, 2015 11:51 AM
To: Tim Hennigar
Cc: [hidden email]
Subject: Re: [SPSSX-L] Python question

 

This line
        Submit(r"""
should be
        spss.Submit(...



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




From:        Tim Hennigar <[hidden email]>
To:        [hidden email]
Date:        06/01/2015 09:37 AM
Subject:        [SPSSX-L] Python question
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





Hi all,
 
I am not a Python guru by any means and I am having an issue that I hope I can get help with
I have a running instance of SPSS – with open ouptut and syntax documents (just one of each)
I run a simple Python program block within the running SPSS session
 
BEGIN PROGRAM PYTHON.
 
import sys
 
import spss #; help(spss)
 
sys.path.insert(0, r"C:\Work_Home\MergeDev")
 
import TWHV23MergeSigTest
 
TWHV23MergeSigTest.MergeRoutine()
 
END PROGRAM.
 
to format my output (this just deletes notes, warnings etc – essentially leaving just the tables) and this runs no problem.
 
 
Now I want to add within the TWHV23MergeSigTest python function a call to run a ‘sbs’ script.
(this is a pre 16 script I wrote that I figure wont run – but the first step is to try and run it and I cant do that).
I have tried the following syntax
 
    try:
 
        Submit(r"""
        SCRIPT "C:\Work_Home\MergeDev\TESTTIMHMergeTestingScriptV4.sbs".
        """)    
 
    except:
        raise
 
 
and I get an error identifying  Submit(r”””
NameError: global name ‘Submit’ is not defined
 
 
I am confused as to why I cant run Submit at this point?
 
 
 
 
 
 
 
 
Thanks!
 
*********************************
Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.
 

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Python question

Albert-Jan Roskam-2
You should do:

from spss import *
Submit(r""""""")

Or (preferred):

import spss
spss.Submit(r""""""")


From: Tim Hennigar <[hidden email]>;
To: <[hidden email]>;
Subject: Re: [SPSSX-L] Python question
Sent: Mon, Jun 1, 2015 3:54:22 PM

 

 

Ahh  - the forest for trees – thank you!

 

 

 

Thanks!

 

<a rel="nofollow" shape="rect" ymailto="mailto:tim.hennigar@sympatico.ca" target="_blank" href="javascript:return">tim.hennigar@...

(W) 416-947-7807

(H)  905-987-3250

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

Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.

 

From: Jon K Peck [mailto:[hidden email]]
Sent: Monday, June 01, 2015 11:51 AM
To: Tim Hennigar
Cc: [hidden email]
Subject: Re: [SPSSX-L] Python question

 

This line
        Submit(r"""
should be
        spss.Submit(...



Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
<a rel="nofollow" shape="rect" ymailto="mailto:peck@us.ibm.com" target="_blank" href="javascript:return">peck@...
phone: 720-342-5621




From:        Tim Hennigar <<a rel="nofollow" shape="rect" ymailto="mailto:tim.hennigar@sympatico.ca" target="_blank" href="javascript:return">tim.hennigar@...>
To:        <a rel="nofollow" shape="rect" ymailto="mailto:SPSSX-L@LISTSERV.UGA.EDU" target="_blank" href="javascript:return">SPSSX-L@...
Date:        06/01/2015 09:37 AM
Subject:        [SPSSX-L] Python question
Sent by:        "SPSSX(r) Discussion" <<a rel="nofollow" shape="rect" ymailto="mailto:SPSSX-L@LISTSERV.UGA.EDU" target="_blank" href="javascript:return">SPSSX-L@...>





Hi all,
 
I am not a Python guru by any means and I am having an issue that I hope I can get help with
I have a running instance of SPSS – with open ouptut and syntax documents (just one of each)
I run a simple Python program block within the running SPSS session
 
BEGIN PROGRAM PYTHON.
 
import sys
 
import spss #; help(spss)
 
sys.path.insert(0, r"C:\Work_Home\MergeDev")
 
import TWHV23MergeSigTest
 
TWHV23MergeSigTest.MergeRoutine()
 
END PROGRAM.
 
to format my output (this just deletes notes, warnings etc – essentially leaving just the tables) and this runs no problem.
 
 
Now I want to add within the TWHV23MergeSigTest python function a call to run a ‘sbs’ script.
(this is a pre 16 script I wrote that I figure wont run – but the first step is to try and run it and I cant do that).
I have tried the following syntax
 
    try:
 
        Submit(r"""
        SCRIPT "C:\Work_Home\MergeDev\TESTTIMHMergeTestingScriptV4.sbs".
        """)    
 
    except:
        raise
 
 
and I get an error identifying  Submit(r”””
NameError: global name ‘Submit’ is not defined
 
 
I am confused as to why I cant run Submit at this point?
 
 
 
 
 
 
 
 
Thanks!
 
*********************************
Notice: This e-mail and any attachments may contain confidential and privileged information.  If you are not the intended recipient, please notify the sender immediately by return e-mail, do not use the information, delete this e-mail and destroy any copies.  Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal.  Email transmissions cannot be guaranteed to be secure or error free. The sender therefore does not accept any liability for errors or omissions in the contents of this message that arise as a result of email transmissions.
 

===================== To manage your subscription to SPSSX-L, send a message to <a rel="nofollow" shape="rect" ymailto="mailto:LISTSERV@LISTSERV.UGA.EDU" target="_blank" href="javascript:return">LISTSERV@... (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