temp files and python

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

temp files and python

mpirritano

Listees,

 

In SPSS I’ve chosen to route my temporary files to an spss_temp folder. But when I run spss processes using spss.Submit in python the temp files are routed to my personal temp folder under ‘Documents and Settings’. How do I change this? I’m winding up with dozens of spss temp folders that wind up clogging things up. Do I need to use a command like tempdir in python?

 

Any help, much appreciated!

 

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: temp files and python

Jon K Peck

I presume that you are referring to Python in external mode.  External mode generally does not use your preference settings such as for the temporary directory.  In order to set that location, create an environment variable named
SPSSTMPDIR
with the value being a directory.  Then SPSS will create a temporary folder under that directory for each session regardless of where you run it from.

Normally you would do this from the Control Panel (System/Advanced/Environment Variables), but you could alternatively create this variable in your Python code before starting SPSS.  E.g.,
import os
os.environ["SPSSTMPDIR"] = r"c:\someplace"
import spss
...

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: "Pirritano, Matthew" <[hidden email]>
To: [hidden email]
Date: 12/30/2009 08:46 AM
Subject: [SPSSX-L] temp files and python
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Listees,
 
In SPSS I’ve chosen to route my temporary files to an spss_temp folder. But when I run spss processes using spss.Submit in python the temp files are routed to my personal temp folder under ‘Documents and Settings’. How do I change this? I’m winding up with dozens of spss temp folders that wind up clogging things up. Do I need to use a command like tempdir in python?
 
Any help, much appreciated!
 
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: temp files and python

mpirritano

You presumed correct, and thanks!

 

Matthew Pirritano, Ph.D.

Research Analyst IV

Medical Services Initiative (MSI)

Orange County Health Care Agency

(714) 568-5648


From: Jon K Peck [mailto:[hidden email]]
Sent: Wednesday, December 30, 2009 9:05 AM
To: Pirritano, Matthew
Cc: [hidden email]
Subject: Re: [SPSSX-L] temp files and python

 


I presume that you are referring to Python in external mode.  External mode generally does not use your preference settings such as for the temporary directory.  In order to set that location, create an environment variable named
SPSSTMPDIR
with the value being a directory.  Then SPSS will create a temporary folder under that directory for each session regardless of where you run it from.

Normally you would do this from the Control Panel (System/Advanced/Environment Variables), but you could alternatively create this variable in your Python code before starting SPSS.  E.g.,
import os
os.environ["SPSSTMPDIR"] = r"c:\someplace"
import spss
...

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435


From:

"Pirritano, Matthew" <[hidden email]>

To:

[hidden email]

Date:

12/30/2009 08:46 AM

Subject:

[SPSSX-L] temp files and python

Sent by:

"SPSSX(r) Discussion" <[hidden email]>

 





Listees,
 
In SPSS I’ve chosen to route my temporary files to an spss_temp folder. But when I run spss processes using spss.Submit in python the temp files are routed to my personal temp folder under ‘Documents and Settings’. How do I change this? I’m winding up with dozens of spss temp folders that wind up clogging things up. Do I need to use a command like tempdir in python?
 
Any help, much appreciated!
 
Thanks
Matt
 
Matthew Pirritano, Ph.D.
Research Analyst IV
Medical Services Initiative (MSI)
Orange County Health Care Agency
(714) 568-5648