Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: file already exists error


From   Philipp Rehm <philipp.rehm@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: file already exists error
Date   Fri, 26 Mar 2010 15:47:29 -0400

.
I noticed similar behavior.

This may have something to do with running do-files from an external text-editor (I use Notepad++; Stata/MP 11.0 for Windows, 64-bit x86-64; Win 7).

Running the following code from Stata's editor does not leave a file (such as ST_xxx.tmp) behind in the temporary folder (in my case C:\Users\user\AppData\Local\Temp):

clear all
sysuse auto, clear
preserve
collapse (mean) p=price, by(foreign)
tempfile t
save `t'
restore
merge m:1 foreign using `t'

When I only run the following part of the code from Stata's do-file editor, Stata automatically -restore-s, and no file (such as ST_xxx.tmp) remains in the temporary folder:

clear all
sysuse auto, clear
preserve
collapse (mean) p=price, by(foreign)

However, if I execute the same partial code from Notepad++, the data-set does not get -restore-d automatically, and a file of kind ST_xxx.tmp remains in the folder, even if I -restore- later.

I thought that it was a new feature in Stata 11 that the data-set would not get -restore-ed automatically (if not called), and one I actually liked. But it seems that this is only the case with an external text editor (I haven't tried any other than Notepad++). And it has the annoying side-effect that one runs into the kinds of error messages reported by Elan.

Philipp


On 3/26/2010 3:10 PM, kantor.d@att.net wrote:
Hi.

The file names, such as ST_0000001b.tmp are made up by Stata as you request tempfiles. They are unique wihin your session, and get deleted when your do-file or session ends (whichever created the tempfile).

They are not unique between sessions.

I suspect that at some earlier time, you had generated one or more tempfiles, and then there was some sort of crash or abrupt ending, and Stata did not delete the file(s).

Now, as you request tempfiles, you occasionally bump into those same names. You should look in C:\DOCUME~1\cohened\LOCALS~1\Temp\ to see if there are old tempfiles in there, with names such as ST_0000001b.tmp -- and delete them.

(Another possibility is multiple concurrent users; I don't think you have that.)

HTH
--David


--- On Fri, 3/26/10, Cohen, Elan<cohened@upmc.edu>  wrote:

This is a hard error to report since I get it haphazardly, and it's been impossible for me to replicate.

Occasionally, I will get an error that says:

file C:\DOCUME~1\cohened\LOCALS~1\Temp\ST_0000001b.tmp already exists
r(602);

This error can come after any command; today -symmetry-, yesterday -reshape-.  Sometimes the error will stop happening if I simply rerun the command, sometimes I need to wait 5 minutes, and sometimes I need to restart Stata entirely.

It may be important to know that I don't have admin priveleges on my computer but since it seems to be writing to my personal space, I'm not sure how that would be the problem.

Is there a way to check to check if my Stata installation is corrupt?  Any other suggestions?
[...]



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index