ExifTool Forum

ExifTool => Newbies => Topic started by: grimacing-visor on February 09, 2023, 07:19:22 PM

Title: Inconsistency on the error codes
Post by: grimacing-visor on February 09, 2023, 07:19:22 PM
I'm trying to backfill 20 years of images and as a last ditch effort I am backfilling with the CreateDate and FileModifyDate.  I'm calling this from python on Mac using version 12.52.

I noticed that for two seemingly same commands, for one malformed image one returns an error and one returns a warning.  Shouldn't these be consistent?

hellojoe Desktop % exiftool "-DateTimeOriginal<CreateDate" -if 'not $datetimeoriginal' -ext JPG IMG_3668.jpg
Warning: Bad ExifOffset SubDirectory start - IMG_3668.jpg
Warning: No writable tags set from IMG_3668.jpg
    0 image files updated
    1 image files unchanged
hellojoe Desktop % echo $?
0
hellojoe Desktop % exiftool "-DateTimeOriginal<FileModifyDate" -if 'not $datetimeoriginal' -ext JPG IMG_3668.jpg                 
Warning: Bad ExifOffset SubDirectory start - IMG_3668.jpg
Error: Can't read ExifIFD data - IMG_3668.jpg
    0 image files updated
    1 files weren't updated due to errors
hellojoe Desktop % echo $?
1

Image data

ExifTool Version Number         : 12.52
File Name                       : IMG_3668.jpg
Directory                       : .
File Size                       : 142 kB
File Modification Date/Time     : 2023:02:09 17:09:39-05:00
File Access Date/Time           : 2023:02:09 17:09:48-05:00
File Inode Change Date/Time     : 2023:02:09 17:09:47-05:00
File Permissions                : -rwxr-xr-x
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Exif Byte Order                 : Little-endian (Intel, II)
Warning                         : Bad ExifOffset SubDirectory start
Image Width                     : 421
Image Height                    : 629
Encoding Process                : Progressive DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Image Size                      : 421x629
Megapixels                      : 0.265
Title: Re: Inconsistency on the error codes
Post by: StarGeek on February 09, 2023, 07:55:18 PM
See Exit Status (https://exiftool.org/exiftool_pod.html#EXIT-STATUS)

A warning does not stop the file from being processed.  Data can still be written to it. An error means the file cannot be written to at all.
Title: Re: Inconsistency on the error codes
Post by: grimacing-visor on February 09, 2023, 08:11:33 PM
That makes sense, thank you!