Skip to main content
jmarais
Known Participant
September 26, 2023
Question

Persistent bug when saving jpg files stating wrongly file in use

  • September 26, 2023
  • 4 replies
  • 1440 views

Can someone help me with this extremely persistent bug in Photoshop? When saving jpg files I often get an error stating WRONGLY "Could not save file because the file is already in use or was left open by another application" That is NOT the case. The problem is a result of Photoshop creating a .tmp file and sometimes it removes it and saves the .jpg file correctly but many times it fails and LEFT this .tmp file and it is confusing Photoshop. 

 

To be very clear: This has nothing to do with removable or network drives or any other issues, the problem is 100% with Photoshop, and it is persistent in many versions of Photoshop and when using it on different computers. I want to create a more automated way of saving files that includes both actions and scripts. I tried to catch the error in a script so that it could remove this .tmp file and repeat the process but to no avail.

 

Often I have to remove the .tmp file by hand and repeat the process and often that works. I was thinking of putting in a delay between the process of Photoshop creating the .tmp file and continuing saving the file but could not.

 

I saw many references to this bug and references to removable or network or any other issues, but those are not relevant and .atmp files that are confusing Photoshop and a solution will be dealing with this .tmp file. I can upload my script if someone could help I will be able to catch the error when it happens, so that I can delete the .tmp file and try again, or any other way of dealing with this extremely annoying persistent bug.

This topic has been closed for replies.

4 replies

Trevor.Dennis
Community Expert
September 27, 2023

The Photoshop Temp*** files are how Photoshop stores Scratch files, and are found in the root directory of the Scratch drive.  They can be left on the drive if Photoshop does not close correctly, and any you find when Photoshop (all versions) is closed can safely be deleted.  

 

I can remember scratch drive full issues a while back, but I think that was only on Mac systems.  It might be worth check this link all the same

https://helpx.adobe.com/nz/photoshop/kb/troubleshoot-scratch-disk-is-full.html

 

Reading the OP again, I am not so sure we are talking about the same thing though.  

 

 

 

D Fosse
Community Expert
September 27, 2023

No, this isn't the scratch file.

 

If you save a big file to your desktop, that will take a while to save, you will see this:

 

It normally disappears in a flash. But here it apparently sticks, and prevents the completion of the save.

jmarais
jmaraisAuthor
Known Participant
September 27, 2023

It happens regularly with small files, normal everyday files and it happens even when I try to save it on my main SSD drive. Yes, it is true what you say, it disappears in a flash but it seems that there is a next step in the process and this tmp file can confuse Photoshop in letting it believe the file is in use and then fails to save the original file. If I delete this tmp file and try the process again, it often works correctly. Sometimes a third attempt will work.

D Fosse
Community Expert
September 27, 2023

It does sound like a bug to me. It doesn't happen on my Windows workstations, but I seem to remember having seen it in the past.

 

The temp file is Photoshop's "safe saving". It saves a temporary file first, then when that is error-checked and passed, the original file is replaced. So something must be stalling this process.

 

@jmarais can you go to Help > System Info and post it here? Just paste the whole thing in a reply.

 

Then maybe a moderator could move this to bugs? It may be system-related, but then, most bugs happen under special circumstances.

 

 

jmarais
jmaraisAuthor
Known Participant
September 27, 2023

Thank you! It seems that this issue is appear often given all the question I have seen regarding this and no real answer to any of them,

 

I will do as you suggested because it is an extremely annoying bug.

c.pfaffenbichler
Community Expert
September 27, 2023

Or have you considered doing a search for a file in the target folder the name of which starts with »ps« and ends with ».tmp« before starting the saving of the jpg? 

If someone else is working in the same folder at the same time or several saving processes are queued this might be problematic, though. 

 

Anyway, your reasoning doesn’t seem quite convincing to me yet. 

When the tmp file already exists it does not seem unreasonable for Photoshop to register that. 

But I wonder what rules govern the tmp-file’s name? 

Would the tmp-file throw Photoshop even if it is the remnant of a failed attempt to save in another file format? 

jmarais
jmaraisAuthor
Known Participant
September 27, 2023

Well, whether you are convinced or not, you are WRONG!

No, No, No, it is the same .jpg file that is stored as the .tmp file,

 

IT IS SIMPLE:

I looked at it many times and Photoshop always creates this .tmp file, after that it deletes it and replaces it with the file with the proper extension. Often this .tmp file confuses Photoshop and it fails TO SAVE it as .jpg file and leaves the .tmp file.

 

THE CONTENTS OF THIS TMP FILE IS EXACTLY THE SAME AS THAT OF THE JPG FILE IT IS SUPPOSED TO SAVE.

 

Well, if you refuse to accept what i am experiencing then you probably have not the knowledge and understanding to advice how to del with this persistent bug!

c.pfaffenbichler
Community Expert
September 26, 2023

Your description sound strange to me. 

 

What temp files are you talking about? 

Please post screenshots that illustrate your claim and (obviously) post the Script you are using. 

jmarais
jmaraisAuthor
Known Participant
September 26, 2023

What is strange? And it is not a claim but a fact.

 

For example, when I try to save a jpg file, say 1.jpg, Photoshop first creates a file tempname.tmp in the relevant folder. It then deletes this tempname.tmp file and saves the 1.jpg file. That is the process every time when successfully saving the file but when there is this error, the file tempname.tmp stays on the hard drive in the folder and the file 1.jpg is missing in the folder.

 

These three images demonstrate this bug in action: screenshot 1 is the error, screenshot 2 the .tmp file created, and screenshot 3 the original .jpg file.

 

I will upload screenshots to demonstrate this FACT and the script but the script is irrelevant (besides being used as an attempt to find a workaround for this bug) because it happens whether I use the script or not.

 

I believe this can shed more light on the many questions been posted related to this bug.
<javascriptresource>
    <name>$$$/JavaScripts/Save As/Menu=Save file</name>
    <category>Scripts</category>
</javascriptresource>
#target photoshop

var data = GetDataFromDocument(activeDocument);
var jpegExtension = '.jpg';
var jpgFile = data.folder + '/' + data.fileName + jpegExtension;

jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 12;
activeDocument.saveAs( File(jpgFile), jpgSaveOptions, true, Extension.LOWERCASE);

///////////////////////////////////////////////////////////////////////////////
// Function: GetDataFromDocument
// Usage: pull data about the document passed in
// Input: document to gather data
// Output: Object containing folder, fileName, fileType, extension
///////////////////////////////////////////////////////////////////////////////
function GetDataFromDocument( inDocument ) {

	var data = new Object();
	var fullPathStr = inDocument.fullName.toString();
	var lastDot = fullPathStr.lastIndexOf( "." );
	var fileNameNoPath = fullPathStr.substr( 0, lastDot );
	data.extension = fullPathStr.substr( lastDot + 1, fullPathStr.length );
	var lastSlash = fullPathStr.lastIndexOf( "/" );
	data.fileName = fileNameNoPath.substr( lastSlash + 1, fileNameNoPath.length );
	data.folder = fileNameNoPath.substr( 0, lastSlash );
	data.fileType = inDocument.fullName.type;
	return data;
}

 

 

c.pfaffenbichler
Community Expert
September 27, 2023
quote

That is the process every time when successfully saving the file but when there is this error, the file tempname.tmp stays on the hard drive in the folder and the file 1.jpg is missing in the folder.

What kind of error?

Why does a error happen to begin with? 

On which volume are you working – locally or across a network? 

 

As I cannot reproduce the issue at current I am not sure how it could be worked-around. 

Wrapping the saving in a try-clause with the error-clause including a search/delete for the tmp-file and starting the saving anew seems like a potential approach. Not elegant admittedly. 

 

I for one cannot discern the file structure in your screenshots, could you please not post such narrow snippets in the future?