1

Using Windows 10, I want to send the following flag to exiftool.exe from python using subprocess.call():

-charset FileName=latin

The following command line entry works fine:

exiftool -charset FileName=latin -overwrite_original -createdate="1960:05:01 12:00:00" 
"Tif format EXIF sample\Førskole IMG031.tif"

Setting up the call via python also works. It gives a warning but runs anyway:

subprocess.call(
    ['exiftool', 
    f'-P', 
    f'-overwrite_original_in_place', 
    f'-CreateDate={new_date}', 
    file_or_folder_path])

Gives Warning:    
C:\source\image-file-date-bulk-edit\Tif format EXIF sample\Førskole IMG031.tif
FileName encoding not specified.  Use "-charset FileName=CHARSET"
Warning: FileName encoding not specified - C:\source\image-file-date-bulk-edit\
Tif format EXIF sample\Førskole IMG031.tif

But when I add "-charset FileName=CHARSET" to my subprocess.call() it seems to be ignored by the process:

subprocess.call(
    ['exiftool', 
    f'-charset FileName=latin',
    f'-P', 
    f'-overwrite_original_in_place', 
    f'-CreateDate={new_date}', 
    file_or_folder_path])

Charset flag is ignored and warning persists: 
C:\source\image-file-date-bulk-edit\Tif format EXIF sample\Førskole IMG031.tif
Warning: Tag 'charset' is not defined
FileName encoding not specified.  Use "-charset FileName=CHARSET"
Warning: FileName encoding not specified - C:\source\image-file-date-bulk-edit\Tif format EXIF sample\Førskole IMG031.tif

Why is f'-charset FileName=latin' ignored in the latter case?

Håkon Seljåsen
  • 589
  • 5
  • 18

1 Answers1

3

Try:

subprocess.call(
    ['exiftool', 
    '-charset', 'FileName=latin',
    f'-P', 
    f'-overwrite_original_in_place', 
    f'-CreateDate={new_date}', 
    file_or_folder_path])

-charset and FileName=latin should be two different arguments when passing them as list.

Piotr Praszmo
  • 17,928
  • 1
  • 57
  • 65