Unable to load the library cells using library_by_name

Hi,

I am trying to access library cells through python scripting.
I can see the list of all libraries- when I use print(pya.Library.library_names())
But when I try to access that library using pya.Library.library_by_name() it gives an output "None"
The technology file was loaded using Tools--> Manage Technologies, and is also copied in the "tech" and "salt" folders.
How can I access this library through scriting. Please help!

Niharika

Comments

  • Hi @Niharika04,

    I assume your library is bound to a technology. When you use "library_by_name" without "for_technology", you will not see these libraries. "library_by_name" applies the name and technology filter. Omitting "for_technology" does not mean "ignore technology attribute", but means "give me libraries not bound to a technology".

    So either specify a technology for iterate over libraries using a look like this:

    for id in pya.Library.library_ids():
      lib = pya.Library.library_by_id(id)
      if lib.name() == name:
        ...
    

    or

    [ pya.Library.library_by_id(id) for id in pya.Library.library_ids() if pya.Library.library_by_id(id).name() == name ]
    

    Matthias

  • Hi Matthias, Thank you for getting back to me.
    I appreciate your response, it helped me fix the issue in my script.
    Regards,
    Niharika

Sign In or Register to comment.