5 Replies Latest reply on Aug 13, 2010 8:01 PM by areohbee

    Attempt to access property "{meta id}" not declared in {plugin name}'s Info.lua

    Jonathon LeFaive Level 3

      I'm trying to photo:setPropertyForPlugin for a field id that i have successfully created. But I am getting this error when I disable the plugin. It reloads without error. Needless to say, it's not successfully writing the metadata.  Is there something that I have to declare in the info.lua? It seems that the error is suggesting that.

       

      Error Message:

      An Internal error has occurred:

      Attempt to access property "tagboolean" not declared in com.jonathonlefaive.tagstatus's Info.lua

        • 1. Re: Attempt to access property "{meta id}" not declared in {plugin name}'s Info.lua
          areohbee Level 5

          The problem is in the timing - you probably have a thread that is still active when the plugin is disabled(?). Disabling the plugin makes the metadatas "undeclared".

           

          Consider setting a flag in LrShutdownPlugin and shutdown obsolete threads. There's also an LrDisablePlugin that you should look into (so should I)

           

          R

          1 person found this helpful
          • 2. Re: Attempt to access property "{meta id}" not declared in {plugin name}'s Info.lua
            Jonathon LeFaive Level 3


            I only have one thread, though, and it is the startAsyncTask that inlcludes the function that I am trying to run. That is unless withWriteAccessDo's are considered threads. Either way, my script must be getting caught up on these wWAD's and then throwing the error because the thread that im trying to run is caught up.  I say this because I cant seem to get my plugin installed with the wWAD's syntaxually by-the-book.

             

            Currently the wWAD's look like this and is the only way they will install without diagnostic errors:

                 catalog:withPrivateWriteAccessDo(photo:setPropertyForPlugin(_PLUGIN, 'tagboolean', 'true', 2))

             

            the API says to do them like this:

                 catalog:withWriteAccessDo( function( context ) 
                      -- do something that reads or writes catalog
                  end )

            Every time I put the "end" in there, LR says that it doesnt like where the ")" is at.

            How do I get this "end" in there properly?
            • 3. Re: Attempt to access property "{meta id}" not declared in {plugin name}'s Info.lua
              areohbee Level 5

              wWAD's are ordinary functions, not threads, but you are starting a task which may be still running when the plugin is disabled, right?

               

              anyway, the 'end' must be paired with the 'function' keyword - then it should work, no? -

               

              catalog:withPrivateWriteAccessDo( function()

                   photo:setPropertyForPlugin(_PLUGIN, 'tagboolean', 'true', 2)

              end )

               

              works, eh?

               

              R

              • 4. Re: Attempt to access property "{meta id}" not declared in {plugin name}'s Info.lua
                Jonathon LeFaive Level 3

                areohbee wrote:

                 

                anyway, the 'end' must be paired with the 'function' keyword - then it should work, no? -

                 

                catalog:withPrivateWriteAccessDo( function()

                     photo:setPropertyForPlugin(_PLUGIN, 'tagboolean', 'true', 2)

                end )

                 

                works, eh?

                Yes, This way installed successfully. Thank You!

                 

                areohbee wrote:

                 

                The problem is in the timing - you probably have a thread that is still active when the plugin is disabled(?). Disabling the plugin makes the metadatas "undeclared".

                It turns out that the reason that there was an active thread was because I had a For Loop that included my entire catalog. Such a process will take a minute or two. Who woulda thought, .  And I was disabling it shortly after reload.

                 

                I actually had an If Then conditional in place that was preventing the wWAD from being called, so that is why there was no error for the wWAD being implemented incorrectly.

                 

                I still have a lot of work to do on this plugin, but I am thrilled that this script is working correctly now. Thank you very much for your help, Rob!