ExifTool Forum

General => Other Discussion => Topic started by: priyamsaha on May 24, 2023, 04:01:41 AM

Title: Warning: [minor] Entries in ExifIFD were out of sequence. Fixed
Post by: priyamsaha on May 24, 2023, 04:01:41 AM
Hi, I am using pyexif in one of my scripts and when editing the UserComment field of the EXIF I am getting the below warning:
"Warning: [minor] Entries in ExifIFD were out of sequence. Fixed"The process executes success fully but I get the warning which halts the rest of the python program. Please let me know if there's a way to bypass the warning. Below is the python code for reference:

cwd = 'ps/exif/images'
for f in sorted(os.listdir(cwd)):
        image = Image.open(f)
        metadata = pyexif.ExifEditor(f)
        exif = json.loads(metadata.getTag('UserComment'))
        exif["header"]["device"]="test"
        exif_str = json.dumps(exif)
        metadata.setTag('UserComment', exif_str)
Title: Re: Warning: [minor] Entries in ExifIFD were out of sequence. Fixed
Post by: Phil Harvey on May 24, 2023, 11:09:28 AM
You can bypass minor warnings by adding the -m option to the command, but I don't know how to do this via pyexif.

- Phil
Title: Re: Warning: [minor] Entries in ExifIFD were out of sequence. Fixed
Post by: StarGeek on May 24, 2023, 11:31:19 AM
Assuming that this is the library (https://github.com/EdLeafe/pyexif) you're using, there doesn't seem to be very many options and nothing about the return codes.  You'll have to ask the author about it.

But looking through the code, its options seems quite limited. And it looks like it it doesn't use the -stay_open option (https://exiftool.org/exiftool_pod.html#stay_open-FLAG), which means it would be running exiftool once for every file, which is Common Mistake #3 (https://exiftool.org/mistakes.html#M3) and will take longer to process a large number of files.

I would suggest changing to PyExifTool (https://github.com/sylikc/pyexiftool).  It is more complex, but it allows you to directly command exiftool.  It also run exiftool using the -stay_open option and will be faster for a large number of files.