Project

General

Profile

Bug #1133

" **(process:29414): WARNING: No namespace info available for xmp prefix 'lr'"

Added by Vey Zimba about 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
xmp
Target version:
Start date:
31 Oct 2015
Due date:
% Done:

100%

Estimated time:
2.00 h

Description

Error msg:
" **(process:29414): WARNING: No namespace info available for xmp prefix 'lr'"

Sometimes I can't seem to add strings under hierarchicalSubject or privateRTKInfo (only some DNG). I can add strings to these DNG only by first editing the files in Adobe Lightroom and adding the strings there. Working on Python here, using the wrapper GExiv2.

History

#1

Updated by Robin Mills about 6 years ago

  • Category set to xmp
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.26

I'll help you with this, however you'll have to help me a little more. "Sometimes" is a vague term. I've never figured out how to build and use the Gexiv2 wrapper.

Can I ask you to find a way to reliably reproduce this with the command-line tool exiv2(.exe) and give me the appropriate commands and test files.

I'm not sure I've understood what you are saying about adding strings in Lightroom. If it's working in Lightroom, what does that have to do with Exiv2?

#2

Updated by Vey Zimba about 6 years ago

Sorry, I meant some DNG files. The interesting part here is that the "No namespace" error stops if I add text to the DNG files in Lightroom. So I'm assuming that Lightroom creates the "space". I'll do as you've told me asap. Thanks!

#3

Updated by Alan Pater about 6 years ago

What version of exiv2 and gexiv2 are you using?

The "lr" namespace was added to exiv2 starting with version 0.25.

If you need to do this with a previous version of exiv2, you would need to register the "lr" namespace before trying to add text to those properties.

#4

Updated by Robin Mills about 6 years ago

Alan's right. 'lr' was only added quite recently.

510 rmills@rmillsmbp:~/clanmills $ exiv2 --verbose --version --grep lr
exiv2 0.25 001900 (64 bit build)
xmlns=lr:http://ns.adobe.com/lightroom/1.0/
511 rmills@rmillsmbp:~/clanmills $ 
Dump the xmp before/after adding something in LightRoom. Something like this:
515 rmills@rmillsmbp:~/temp $ exiv2 -pX S.jpg | xmllint -pretty 2 - | grep xmlns
    xmlns:x="adobe:ns:meta/" 
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
        xmlns:xmp="http://ns.adobe.com/xap/1.0/" 
        xmlns:dc="http://purl.org/dc/elements/1.1/" 
516 rmills@rmillsmbp:~/temp $ 

I'm going to use exiv2 to add some LR data, I think this is what you're doing in LightRoom. I do two things:

1) I use reg to register the namespace
2) I use the namespace

516 rmills@rmillsmbp:~/temp $ exiv2 -M"reg lr http://ns.adobe.com/lightroom/1.0" -M"set Xmp.lr.rmills engineer" S.jpg
And now, the namespace is in the XMP.
517 rmills@rmillsmbp:~/temp $ exiv2 -pX S.jpg | xmllint -pretty 2 - | grep xmlns
    xmlns:x="adobe:ns:meta/" 
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
        xmlns:xmp="http://ns.adobe.com/xap/1.0/" 
        xmlns:dc="http://purl.org/dc/elements/1.1/" 
        xmlns:lr="http://ns.adobe.com/lightroom/1.0/" 
518 rmills@rmillsmbp:~/temp $
You will need exiv2 version v0.25 to obtain the -pX feature.

You don't need to use the "-Mreg lr http://..." command with exiv2 v.025. You will need it for v0.24 and earlier.

#5

Updated by Robin Mills about 6 years ago

  • Status changed from Assigned to Resolved
  • Assignee changed from Robin Mills to Alan Pater
  • % Done changed from 0 to 100
  • Estimated time set to 2.00 h

I'm going to set the status of this to Resolved/100% and assign the solution to Alan.

Vey: If you have further information about this matter, the issue will remain open for a while and you are welcome to share further discoveries. The issue will be closed before we ship v0.26 (currently scheduled for Spring 2016).

#6

Updated by Vey Zimba about 6 years ago

I got it to work somewhat by first registering the xmp namespace 'lr' before trying to add a value. The only remaining issue is that the 'hierarchicalSubject' sets to 'XmpText' instead of 'XmpBag', so it keeps replacing my old value with the new value when I try to add to 'hierarchicalSubject'. I'm still using GExiv2, so if anyone knows a work-around to this issue please let me know. Thanks for all the help so far.

#7

Updated by Alan Pater about 6 years ago

You need to also specify the property type, in this case XmpBag.

This is automatic with exiv2 0.25 and greater as these XMP properties are pre-registered. With previous version, you need to specify the type as well as registering the lr namespace.

#8

Updated by Vey Zimba about 6 years ago

I've tried but failed to specify the type, set_tag_struct and set_xmp_tag_struct don't seem to work in GExiv2('Metadata' object has no attribute 'set_tag_struct'/'set_xmp_tag_struct').

Seems to be something wrong in the python wrapper GExiv2?

#9

Updated by Robin Mills about 6 years ago

Regrettably, Team Exiv2 cannot support GExiv2. In fact, I haven't been able to build GExiv2 on my Mac.

#10

Updated by Vey Zimba about 6 years ago

I see! I'm asking here since I saw you posting in this thread:
https://bugzilla.gnome.org/show_bug.cgi?id=712477

I don't understand where to place the "work-around" solution in comment6.

#11

Updated by Alan Pater about 6 years ago

Well, it works if you use gexiv2 with exiv2 0.25. I don't know how to get it working on previous versions.

#12

Updated by Vey Zimba about 6 years ago

That's what I'm using. I just don't understand what/where to place the code from comment6.

#13

Updated by Robin Mills about 6 years ago

Vey:

Without building and running this stuff, I can't follow what's being discussed. I'll try to build this on Linux this evening and maybe that will work. On the Mac, it doesn't build the python binding:

847 rmills@rmillsmbp:~/gnu/gexiv2 $ ./configure --enable-introspection
... rattle roll ...
GExiv2 will be built with prefix /usr/local for x86_64-apple-darwin15.0.0 (cross-compiling: no).

Options:
    Introspection:      yes
    Python2 binding:    no
    Python3 binding:    no
    Tests and utils:    no

849 rmills@rmillsmbp:~/gnu/gexiv2 $ 
It hasn't done this because there's something missing in python. ./configure is running this code:
enable_python2="no (introspection disabled)" 
enable_python3="no (introspection disabled)" 
if test "x$enable_introspection" = "xyes"; then
    # Used to determine where Python wants the .gi file to be installed ...
    # if Python is not installed, PYTHON2 and PYTHON3 will be empty
    PYTHON="import gi; print(gi._overridesdir)" 
    PYTHON2_GIDIR=$(python2 -c "$PYTHON")
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python2 GObject Introspection directory: $PYTHON2_GIDIR" >&5
$as_echo "Python2 GObject Introspection directory: $PYTHON2_GIDIR" >&6; }
    PYTHON3_GIDIR=$(python3 -c "$PYTHON")
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python3 GObject Introspection directory: $PYTHON3_GIDIR" >&5
$as_echo "Python3 GObject Introspection directory: $PYTHON3_GIDIR" >&6; }
    if test "x$PYTHON2_GIDIR" != "x"; then
        enable_python2=yes
    else
        enable_python2=no
    fi
    if test "x$PYTHON3_GIDIR" != "x"; then
        enable_python3=yes
    else
        enable_python3=no
    fi
So module gi is present, however it doesn't have go._overridesdir. I haven't dug deeper.
850 rmills@rmillsmbp:~/gnu/gexiv2 $ python
Python 2.7.10 (default, Aug 22 2015, 20:33:39) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> print(gi._overridesdir)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '_overridesdir'
>>> 
If you know how to get this built, I might be able to help you.

#14

Updated by Robin Mills about 6 years ago

I'll have a look at this tonight on Linux. I want to work in the garden this afternoon. There's a big storm heading for England tonight and I want to deal with some stuff outside before "a hard-rain's a gonna fall" (and 100km/hour winds).

#15

Updated by Robin Mills about 6 years ago

Vey:

I have gexiv2 built and working on Linux. It's using libexiv2 v0.25. I've lost the plot. What's the question here?

#16

Updated by Alan Pater about 6 years ago

Vey, what version of exiv2 are you using?

#17

Updated by Alan Pater about 6 years ago

Vey, so you are asking how to adapt the script sample from https://bugzilla.gnome.org/show_bug.cgi?id=712477#c6 to your situation? I can't be much help, I just borrowed and adapted that script from elsewhere. It assumes exiv2 0.25 with the lr namespace and properties already registered. If you have 0.25 and it does not work, perhaps you have multiple exiv2 library versions installed and are getting conflicts.

#!/usr/bin/python3

from sys import argv, exit

try:
    from gi.repository import GExiv2
except ImportError:
    exit('You need to install gexiv2 first.')

if len(argv) < 2:
    exit('Please specify an image on the commandline.')

# Note, these are equivalent:
metadata = GExiv2.Metadata()
metadata.open_path(argv[-1])
# metadata = GExiv2.Metadata(argv[-1])

tags = '1st|3rd|4th'
metadata['Xmp.lr.hierarchicalSubject'] = tags
if metadata['Xmp.lr.hierarchicalSubject.'] == tags:
    print('I just set the LR tags to %s.' % tags)
else:
    print('There was a problem setting the LR tags.')

# If you wanted to save your changes, call save_file:
metadata.save_file()

You mentioned some DNG files. Have you tested that you can write XMP to those files from the exiv2 command line? It maybe that your DNG's are not yet writeable.

#18

Updated by Vey Zimba about 6 years ago

I'm using Exiv2 v0.25 as well. The problem is when I register 'lr' in Python (GExiv2) it registers hierarchicalSubject as XmpText instead of XmpBag.
pic.register_xmp_namespace('http://ns.adobe.com/lightroom/1.0/', 'lr')

#19

Updated by Robin Mills about 6 years ago

This seems to be working OK for me. Here's what I see.

I started with an image I took at Stonehenge in July. It has Iptc,XMP and GPS data:

rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$ cp /Home/Pictures/2015/Stonehenge/DSC_7146.jpg IMG_1234.JPG
rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$ exiv2 -pa --grep GPS --grep Iptc IMG_1234.JPG 
Exif.Image.GPSTag                            Long        1  4060
Exif.GPSInfo.GPSVersionID                    Byte        4  2.3.0.0
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  51deg 10.74120' 
Exif.GPSInfo.GPSLongitudeRef                 Ascii       2  West
Exif.GPSInfo.GPSLongitude                    Rational    3  1deg 49.58650' 
Exif.GPSInfo.GPSAltitudeRef                  Byte        1  Above sea level
Exif.GPSInfo.GPSAltitude                     Rational    1  97 m
Exif.GPSInfo.GPSTimeStamp                    Rational    3  14:34:09.2
Exif.GPSInfo.GPSSatellites                   Ascii       3  08
Exif.GPSInfo.GPSMapDatum                     Ascii      17  WGS-84          
Exif.GPSInfo.GPSDateStamp                    Ascii      11  2015:07:16
Iptc.Envelope.ModelVersion                   Short       1  4
Iptc.Envelope.CharacterSet                   String      3  
Iptc.Application2.RecordVersion              Short       1  4
Iptc.Application2.Caption                    String     18  Blackbird on Guard
I've used the code here https://wiki.gnome.org/Projects/gexiv2/PythonSupport and put it in the file GnomeTest.py which operates on the file IMG_1234.JPG
rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$ python GnomeTest.py 
rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$ exiv2 -pa --grep GPS --grep Iptc IMG_1234.JPG 
Exif.Image.GPSTag                            Long        1  4096
Exif.GPSInfo.GPSVersionID                    Byte        4  2.0.0.0
Exif.GPSInfo.GPSLatitudeRef                  Ascii       2  North
Exif.GPSInfo.GPSLatitude                     Rational    3  43deg 37' 46.221" 
Exif.GPSInfo.GPSLongitudeRef                 Ascii       2  West
Exif.GPSInfo.GPSLongitude                    Rational    3  79deg 23' 49.093" 
Exif.GPSInfo.GPSAltitudeRef                  Byte        1  Above sea level
Exif.GPSInfo.GPSAltitude                     Rational    1  76.0 m
Exif.GPSInfo.GPSMapDatum                     Ascii       7  WGS-84
Iptc.Envelope.ModelVersion                   Short       1  4
Iptc.Envelope.CharacterSet                   String      3  
Iptc.Application2.RecordVersion              Short       1  4
Iptc.Application2.Caption                    String     18  Blackbird on Guard
Iptc.Application2.City                       String      7  Toronto
Iptc.Application2.ProvinceState              String      7  Ontario
Iptc.Application2.CountryName                String      6  Canada
Stonehenge has been instantly moved to Canada!.

Then I modified Alan's code to operate on the file IMG_1234.py as follow:

#!/usr/bin/python3

from sys import argv, exit

try:
    from gi.repository import GExiv2
except ImportError:
    exit('You need to install gexiv2 first.')

metadata = GExiv2.Metadata()
metadata.open_path('IMG_1234.JPG')

tags = '1st|3rd|4th'
metadata['Xmp.lr.hierarchicalSubject'] = tags
if metadata['Xmp.lr.hierarchicalSubject'] == tags:
    print('I just set the LR tags to %s.' % tags)
else:
    print('There was a problem setting the LR tags.')

# If you wanted to save your changes, call save_file:
metadata.save_file()
Run Alan's code and dump the XMP:
rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$ python AlanTest.py 
I just set the LR tags to 1st|3rd|4th.
rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$ exiv2 -pX IMG_1234.JPG | xmllint --pretty 2 -
<?xml version="1.0"?>
<?xpacket
begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta
    xmlns:x="adobe:ns:meta/" 
    x:xmptk="XMP Core 4.4.0-Exiv2" 
  > <rdf:RDF
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    > <rdf:Description
        xmlns:xmp="http://ns.adobe.com/xap/1.0/" 
        xmlns:dc="http://purl.org/dc/elements/1.1/" 
        xmlns:lr="http://ns.adobe.com/lightroom/1.0/" 
        rdf:about="" 
        xmp:Rating="0" 
        xmp:ModifyDate="2015-07-16T20:24:52+01:00" 
      > <dc:description
        > <rdf:Alt
          > <rdf:li
              xml:lang="x-default" 
            >Blackbird on Guard</rdf:li
          > </rdf:Alt
        > </dc:description
      > <lr:hierarchicalSubject
        > <rdf:Bag
          > <rdf:li
            >1st|3rd|4th</rdf:li
          > </rdf:Bag
        > </lr:hierarchicalSubject
      > </rdf:Description
    > </rdf:RDF
  > </x:xmpmeta
>
<?xpacket
end="w"?>
rmills@rmillsmbp-k1504:~/gnu/exiv2/trunk$
HierarcharchicalSubject is in a Bag.

Does this look correct to you guys?

#20

Updated by Robin Mills almost 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF