sylikc / pyexiftool

PyExifTool (active PyPI project) - A Python library to communicate with an instance of Phil Harvey's ExifTool command-line application. Runs one process with special -stay_open flag, and pipes data to/from. Much more efficient than running a subprocess for each command!
Other
144 stars 17 forks source link

Exiftool location #62

Closed tester0077 closed 1 year ago

tester0077 commented 1 year ago

What assumptions are made regarding the location of the Exiftool library/executable? Is there a way specify a specific path or executable? For Windows> For Linux?

I have a packaged app - Gramps AIO https://gramps-project.org/blog/ - and would like to be able to use the Python interface, but under windows there seems to be no way. I am inexperienced enough to not be able to figure that out from the Python source of this interface Edit: At present, Gramps marks the plugin unavailable if it cannot find the exiftool executable while it is parsing the "import exiftool" statement. Edit 2: For Windows, Exiftool.exe is on the PATH

sylikc commented 1 year ago

The executable property is used to specify the executable, or in the constructor. https://sylikc.github.io/pyexiftool/reference/1-exiftool.html#exiftool.ExifTool.executable

As per the documentation, the default executable is exiftool.exe on windows, and exiftool on linux. As long as it's found in the PATH, it will be detected by pyexiftool

tester0077 commented 1 year ago

Understood, but as far as I know, either version (Phil Harvey's or Oliver Betz's) needs a number of supporting files and data. I have raised a question on the Gramps forum whether there is an equivalent place as part of its AIO package to which I could (manually if necessary). copy the required files. While I am waiting for clarification, (and I don't know if this is the proper place to ask,) I do worry as to what algorithm that executable would use to look for support files: relative to the EXE's location or would it also use the PATH.

emyoulation commented 1 year ago

@tester0077 The Command Line Interface "version" options for the Gramps executable will list paths for your installation. The text-based list includes Python and the OS environment variables.

like:


 PYTHONPATH:
    /usr/lib/python3/dist-packages/gramps
    /usr/bin
    /usr/lib/python37.zip
    /usr/lib/python3.7
    /usr/lib/python3.7/lib-dynload
    /usr/local/lib/python3.7/dist-packages
    /usr/lib/python3/dist-packages
tester0077 commented 1 year ago

That data is for the linux version :-) On my Win machine I have: PYTHONPATH: C:\Program Files\GrampsAIO64-5.1.5\gramps C:\Program Files\GrampsAIO64-5.1.5 C:\Program Files\GrampsAIO64-5.1.5\lib C:\Program Files\GrampsAIO64-5.1.5\lib/python36.zip C:\Program Files\GrampsAIO64-5.1.5\lib\python3.6 C:\Program Files\GrampsAIO64-5.1.5\lib\python3.6\lib-dynload C:/building/msys64/mingw64 Which is all well & good, but a) there are too many possibilities for a brute force approach which would try all possible options/combinations b) Exiftool's algorithm may well differ and look for other places c) would I try all this with the Windows or Linux version?

wroldwiedbwe commented 1 year ago

@tester0077 maybe not what your looking for but how about using a method similar to what the google map xml addon uses to locate the program on windows ?

tester0077 commented 1 year ago

AFAIK, it is not so much a matter of finding the app's location, but how to make the plug-in and its host code within the Gramps AIO package aware of and able to use it. I just don't know enough about what is going on inside the AIO code. Had tried to follow a suggestion and code for another gramplet which 'imports' some needed code, but had no luck with that either.

sylikc commented 1 year ago

@tester0077 I'm unable to help you on this thread as I don't have familiarity with the Gramps project. Please ask on their forums or file an issue on their bug tracker. You can even link to this issue, if it is related to something PyExifTool is doing.

Otherwise, I'm closing the issue for now. Thanks for everyone else who commented with suggestions!