Sometimes getting filename_exiftool_tmp already exists error

Started by Curtis, March 14, 2013, 06:36:27 PM

Previous topic - Next topic

Curtis

I have my vb.net wrapper working pretty well but occasionally I get an error msg from stderr like:
QuoteError: Temporary file already exists: D:/Pictures/ExiftoolTestFolder/AzzIMG_1564.JPG_exiftool_tmp

In my code immediately before sending the -execute command I do check to see if this file exists and it does not.  So far I have only noticed this problem when using the -Tagsfromfile with the -overwrite_original commands.  I have also been able to reproduce (but very infrequently) by running the input file from the DOS command line.

The input file 'exiftoolCmdFile.txt' generated by my test program is:
-overwrite_original
-Tagsfromfile
D:\Pictures\ExiftoolTestFolder\IMG_1310.JPG
-all:all
D:\Pictures\ExiftoolTestFolder\AzzIMG_1310.JPG
-execute
-overwrite_original
-Tagsfromfile
D:\Pictures\ExiftoolTestFolder\IMG_1558.JPG
-all:all
D:\Pictures\ExiftoolTestFolder\AzzIMG_1558.JPG
-execute
-overwrite_original
-Tagsfromfile
D:\Pictures\ExiftoolTestFolder\IMG_1564.JPG
-all:all
D:\Pictures\ExiftoolTestFolder\AzzIMG_1564.JPG
-execute
-overwrite_original
-Tagsfromfile
D:\Pictures\ExiftoolTestFolder\IMG_1601.JPG
-all:all
D:\Pictures\ExiftoolTestFolder\AzzIMG_1601.JPG
-execute


I start exiftool with 'exiftool -stay_open True -@ exiftoolCmdFile.txt'

The output (stdout and stderr mixed):
stdout:
    0 image files updated
    1 files weren't updated due to errors
{ready}

stderr:
Error: Temporary file already exists: D:/Pictures/ExiftoolTestFolder/AzzIMG_1310.JPG_exiftool_tmp

stdout:
    1 image files updated
{ready}

stderr:

stdout:
    0 image files updated
    1 files weren't updated due to errors
{ready}

stderr:
Error: Temporary file already exists: D:/Pictures/ExiftoolTestFolder/AzzIMG_1564.JPG_exiftool_tmp

stdout:
    1 image files updated
{ready}

stderr:


The .jpg files are all about 2.4 to 2.7mb.

I do not consistently get this error and the error is not always on the same files, but the longer the list of files I have more frequent errors.  I made sure I have no other programs accessing the files at the time (like Picasa, etc.).  Seems like a timing issue, but I wait for the '{ready}' before proceeding on to the next -execute command.

Any ideas what I'm not checking for? or?  (Been banging my head on the wall for a few days on this one... ahhhh!     :-X)

Thanks!
Curtis

Phil Harvey

Hi Curtis,

If you get a "Temporary file already exists message, you should have also gotten an "error renaming temporary file" error beforehand.

This could possibly happen if ExifTool's file handling is disrupted by a virus scanner that locked the temporary file, preventing ExifTool from renaming it.  You can search for this in the forum, but I think the solution is to add ".jpg_exiftool_tmp" to the list of excluded file extensions in the virus scanner.

This is only a problem in Windows.  Other filesystems don't suffer from this denial-of-service vulnerability.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bhaity

Hi phil,

I'm new to exiftoo, and I'm using it through a ruby web app. I'm getting the same errors as Curtis both locally on my mac as well as on our ubuntu server (so not using windows at all).

I'm writing iptc metadata to an image one field at a time. Is there a smarter to do this, and could this be the cause of the  "Temporary file already exists" and "error renaming temporary file" errors?
This is how I'm using exiftool (calling the command line through ruby):

      %x[exiftool -iptc:DateCreated="#{event.date_created}" #{path}]
      %x[exiftool -iptc:DigitalCreationDate="#{event.date_created}" #{path}]
      %x[exiftool -iptc:DigitalCreationTime="#{event.time_created}" #{path}]
      %x[exiftool -iptc:Headline="#{event.name}" #{path}]
      %x[exiftool -iptc:By-line="#{event.by_line}" #{path}]
      %x[exiftool -iptc:City="#{event.city}" #{path}]
      %x[exiftool -iptc:Province-State="#{event.state}" #{path}]
      %x[exiftool -iptc:Country-PrimaryLocationName="#{event.country_primary_location_name}" #{path}]
      %x[exiftool -iptc:CopyrightNotice="#{event.copyright_notice}" #{path}]
      %x[exiftool -iptc:Sub-location="#{event.sub_location}" #{path}]
      %x[exiftool -iptc:Caption-Abstract="#{people_string}" #{path}]

I'm getting the errors quite often locally, but only 1 out of 100 photos on the server. Let me know if you have any input.

Thanks for your help!

Phil Harvey

I don't know about the errors, but it is VERY inefficient to write one tag at a time.  You should be doing this:

%x[exiftool -iptc:DateCreated="#{event.date_created}" -iptc:DigitalCreationDate="#{event.date_created}" -iptc:DigitalCreationTime="#{event.time_created}" -iptc:Headline="#{event.name}" -iptc:By-line="#{event.by_line}" -iptc:City="#{event.city}" -iptc:Province-State="#{event.state}" -iptc:Country-PrimaryLocationName="#{event.country_primary_location_name}" -iptc:CopyrightNotice="#{event.copyright_notice}" -iptc:Sub-location="#{event.sub_location}" -iptc:Caption-Abstract="#{people_string}" #{path}]

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bhaity