.ExifTool_config Error: Can't modify constant item in scalar assignment

Started by michaelgill1969, September 24, 2024, 08:59:15 PM

Previous topic - Next topic

michaelgill1969

I am getting the following error when I run exiftool:
"Can't modify constant item in scalar assignment at /home/michael/.ExifTool_config line 37, near ");"

I tried changing the first line in my config file by adding "=>" instead of "=", which generates different errors.

Image::ExifTool::UserDefined = (
  'Image::ExifTool::Exif::Main' => {
    0xd000 => {
      Name => 'Periodical',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd001 => {
      Name => 'Volume',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd002 => {
      Name => 'DOI',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd003 => {
      Name => 'Publisher',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd004 => {
      Name => 'Publication Date',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
);

#------------------------------------------------------------------------------
1;  #end

michaelgill1969

OK, I was missing the "%" on the first line, but my tags still aren't working.  Now I get just "Warning: Tag 'Periodical' is not defined".

%Image::ExifTool::UserDefined = (
  'Image::ExifTool::Exif::Main' => {
    0xd000 => {
      Name => 'Periodical',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd001 => {
      Name => 'Volume',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd002 => {
      Name => 'DOI',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd003 => {
      Name => 'Publisher',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
  'Image::ExifTool::Exif::Main' => {
    0xd004 => {
      Name => 'Publication Date',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
);

1;  #end

Phil Harvey

You are overwriting the value of 'Image::ExifTool::Exif::Main' with each entry.  Try this:

%Image::ExifTool::UserDefined = (
  'Image::ExifTool::Exif::Main' => {
    0xd000 => {
      Name => 'Periodical',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
    0xd001 => {
      Name => 'Volume',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
    0xd002 => {
      Name => 'DOI',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
    0xd003 => {
      Name => 'Publisher',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
    0xd004 => {
      Name => 'PublicationDate',
      Writable => 'string',
      WriteGroup => 'IFD0',
    },
  },
);

1;  #end

Also, tag names shouldn't have spaces.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

michaelgill1969

I'm still getting errors as follows:

$ exiftool -Periodical='Political Psychology' 'Huddy, L. (2001). From social to political identity: A critical examination of social identity theory.pdf'
    0 image files updated
    1 image files unchanged

$ exiftool -config '~/.ExifTool_config' -Periodical='Political Psychology' 'Huddy, L. (2001). From social to political identity: A critical examination of social identity theory.pdf'
Config file not found
Warning: Tag 'Periodical' is not defined
Nothing to do.

Phil Harvey

You are trying to write EXIF information to PDF, but PDF doesn't support that format natively.

I don't know why you are trying to create custom tags, but you should be writing standard XMP tags if possible.  There are a number of pre-defined XMP tags that cover most of what you want to write.  See the XMP tags documentation for a complete list.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

I think the XMP-prism tags are what you are looking for.

Phil, the URL for the PRISM standard has a trailing slash which breaks the link.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Quote from: StarGeek on September 24, 2024, 10:05:15 PMPhil, the URL for the PRISM standard has a trailing slash which breaks the link.

Thanks.  Fixed.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).