Main Menu

ExifTool on DSM7

Started by stefanjoa, August 26, 2021, 04:16:41 AM

Previous topic - Next topic

planetS

Hello,
Perhaps someone could point me into the correct direction ...
I had a python photo sorting script set up on DMS 6 using the cphup ExifTool package.
All was fine until I upgraded to DSM 7 and now I'm fighting since couple of days to get ExifTool to work again in python.
Please note: I've done a complete reinstall of the Synology NAS when upgrading - no old configs left.

I've followed all steps from the latest message of "scrapix". When connected via ssh I'm able to successfully run "exiftool [path of photo]" and I get the desired result by ExifTool properly displayed.

Here is a small python test script to show my current issue:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import os, getpass
print (getpass.getuser())
subprocess.Popen(['exiftool', '/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/temp1.JPG'])


All is fine, if the script is called when logged in via ssh on terminal. It shows first the username and then all exif tags of the photo.

However, when the script is triggered via the Task Scheduler:
python3 /volume1/homes/USERNAME/Drive/Development/Exif-Sorting/test.py

This results in:
Standard output/error:
[same username is shown as when the script is run via terminal]
Traceback (most recent call last):
  File "/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/test.py", line 4, in <module>
    subprocess.Popen(['exiftool', '/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/temp1.JPG'])
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'exiftool'


Perhaps I'm missing some config, that would allow the system to find exiftool? (/etc/profile was updated as in the instructions)
Thanks for any help.

planetS

Well, sorry for the confusion caused - it seems that I just found the answer to my issue.
I need to now refer to the absolute path of exiftool in python.
'/usr/share/applications/ExifTool/exiftool' instead of only 'exiftool'

Now working as well when the python script is triggered from Task Scheduler:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import os, getpass
print (getpass.getuser())
subprocess.Popen(['/usr/share/applications/ExifTool/exiftool', '/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/temp1.JPG'])