ExifTool Forum

ExifTool => Developers => Topic started by: prox on December 14, 2024, 06:05:56 AM

Title: Python script using exiftool cannot detect it
Post by: prox on December 14, 2024, 06:05:56 AM
I've had exiftool installed in WSL for a bit. But this python script (https://github.com/PetrVys/MotionPhoto2) I need to convert Live Photos to Samsung Motion Photos is trying to "import exiftool" within python. Trying to run the script on WSL, it isn't detecting a thing.

I thought it might be some $PATH weirdness I'm not familiar with, so I tried the Windows option suggested by the Github repo, which is just using the Oliver Betz installer, which is very straightforward. Ran it and checked, I have exiftool on Windows now too. But running the script on Windows, it still says "exiftool" is not a Python library.

Is this a me problem? What am I missing?
Thank you.
Title: Re: Python script using exiftool cannot detect it
Post by: Phil Harvey on December 14, 2024, 07:15:59 AM
ExifTool is Perl, not Python.  You need a Python interface to run ExifTool from Python.  Try this (https://github.com/sylikc/pyexiftool).

- Phil
Title: Re: Python script using exiftool cannot detect it
Post by: prox on December 14, 2024, 07:34:31 AM
Yes, that's what I was thinking. I wonder how exactly the author of the Github repo is using exiftool in this way...

Thanks for the help, and for this amazing library!
Title: Re: Python script using exiftool cannot detect it
Post by: Phil Harvey on December 14, 2024, 09:20:58 AM
pyexiftool will be executing exiftool as an external command.

- Phil
Title: Re: Python script using exiftool cannot detect it
Post by: StarGeek on December 14, 2024, 10:24:35 AM
The import exiftool is importing the PyExiftool library that Phil linked to.

Just to verify, when installing the script, you did run the command to install the dependencies (https://github.com/PetrVys/MotionPhoto2?tab=readme-ov-file#dependencies).

The PyExiftool library uses exiftool's -stay_open option (https://exiftool.org/exiftool_pod.html#stay_open-FLAG) to keep exiftool running in the background. This avoids Common Mistake #3 (https://exiftool.org/mistakes.html#M3) which can greatly impact the performance of exiftool
QuoteRunning as a single command is much faster because the startup time of loading ExifTool is significant