DBaur hat geschrieben:
How can a libary be removed by python script from the CODESYS library repository?
Can you give me an example for that?
Here my example code:
print("Find library...")found=librarymanager.find_library("TestLib, 1.0.0.0 (3S-Smart Software Solutions GmbH)")iffound:
  lib, repo=found
  print("Lib: "+lib.displayname)
  print("In repo: {} ({})".format(repo.name, repo.root_folder))
  print("Uninstall library...")
  librarymanager.uninstall_library(repo, lib)
  found=librarymanager.find_library("TestLib, 1.0.0.0 (3S-Smart Software Solutions GmbH)")
  iffound:
    print("Error: Lib ist still there!!!")else:
  print("NO lib was found")
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
\#-*- coding: UTF-8 -*-from__future__importprint_functionimportsys,osfromsysimportexitlibRepository=librarymanagerdefaultRepository=libRepository.repositories[0]defremoveAllCompanyLibs(sCompanyName):Â Â sCompanyName=sCompanyName.upper()Â Â forrepositoryinlibRepository.repositories:Â Â Â Â forlibraryinlibRepository.get_all_libraries(repository):Â Â Â Â Â Â ifsCompanyNameinlibrary.company.upper():Â Â Â Â Â Â Â Â system.write_message(Severity.Information,'Lib removed: '+library.displayname)Â Â Â Â Â Â Â Â libRepository.uninstall_library(repository,library)Â Â system.write_message(Severity.Information,'Removing libraries done')removeAllCompanyLibs('siemens')
you might improve the line where library company is compared to your:
ifsCompanyNameinlibrary.company.upper():
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How can a libary be removed by python script from the CODESYS library repository?
Can you give me an example for that?
Thanks in advance...
I am also interested in such an example
Hi DBaur.
Here my example code:
BR
Martin
Hi Martin
Is it possible to find a library only by company?
So I can uninstall all libraries form one company.
Thanks
Thanks
I might be too late, but here it is:
you might improve the line where library company is compared to your:
Works. Thanks.