LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Library disowns members after copying via LV Scripting

I have some libraries which I use as templates, for example a user event library. I can copy and paste these in Windows Explorer, and then drag into the LV project without problem. Now I have created a small script which will copy the library, add it to my LV project, and change the name. I add the library under another library where it is used in the application. I have actually done something very similar where I add the library to a virtual folder under the LV project with success. However, when I add the library to a virtual folder within another library, then I start to get errors like "this VI claims to be part of a library, but that library does not claim to own this VI." I've checked and the library I'm using as a template does not have this problem. Any ideas?

 

Capture.PNG

0 Kudos
Message 1 of 4
(1,950 Views)

This is turning out to be nastier than I thought. If I take the problem VIs out of the library and add them back in, I will get the white run arrow and can run my application. But, the next time that I open my project, the errors come back. I will go back to manually dragging my libraries into the project for now.

0 Kudos
Message 2 of 4
(1,877 Views)

Two things that jump out at me are:

 

1. You close the library reference right after copying it.  I looked at some old code I made to copy a lvclass file and I always deferred closing any programatically loaded classes until the end of the code so they'd be in memory for any changes that needed to be made.  Might help?

2. There are quite a lot of instances in your code where you didn't connect error wires.  How would you know if an error happened in any of the upstream nodes that might explain why there's a problem?

0 Kudos
Message 3 of 4
(1,864 Views)

Hi Kyle,

 

1. Thanks, I will look at leaving the reference open longer.

2. In this quick and dirty example I mostly just use the error wire to enforce execution order. If there is an unhandled error somewhere the automatic error handling will pop up and tell me though, and I am not seeing any errors occurring.

0 Kudos
Message 4 of 4
(1,850 Views)