Skip to content

MSVC C++ runtime (msvcp140.dll) version conflict #68

Description

@damonlynch

This will segfault on Windows, because PyQt5 pulls in PyQt5\Qt5\bin\msvcp140.dll (version 14.26.28720.3) which is too old for exiv2:

import PyQt5.QtCore
import exiv2


path = r"path\to\photo.jpg"

print(PyQt5.QtCore.PYQT_VERSION_STR)

image = exiv2.ImageFactory.open(path)
image.readMetadata()
exif_data = image.exifData()
print(exif_data["Exif.Photo.FNumber"])

Swapping the import order so that exiv2 is imported before PyQt5 fixes the segfault: exiv2 uses the system msvcp140.dll, and perhaps PyQt5 runs okay with that DLL version too (I am unsure — it might be fine).

Not every photo file will result in a crash when PyQt5 is imported first. Some do not. It might be that whether the crash occurs depends on the code path taken within exiv2, but I'm speculating here. I've noticed that files produced by old cameras do not crash, but those produced by newer camera always crash.

Given Qt5 is now EOL, this may not matter to python-exiv2. I'm unsure if it can be replicated with PyQt6 (I need to test that). I am slowly porting Rapid Photo Downloader to use PyQt6. I am also laying the groundwork for Rapid Photo Downloader to work on Windows in addition to Linux, which is why I have been hit with this problem.

But even if this is not a problem to fix, I think it would be nice to have it documented. It might save somebody else some time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions