Search Project: *:*

 
<< < 1 .. 1155 1156 1157 1158 1159 .. 3700 > >> (Page 1157 of 3700)

(no subject) thecolonel26 wiki (Thread)
Last updated: 2020-09-18

wiki Discussion edwinwl wiki (Discussion)
Forum for wiki comments
Last updated: 2020-09-19

blog Discussion edwinwl blog (Discussion)
Forum for blog comments
Last updated: 2020-09-19

(no subject) edwinwl wiki (Thread)
Last updated: 2020-09-19

Home edwinwl wiki (WikiPage)
This is the personal project of edwinwl. This project is created automatically during user registration as an easy place to store personal data that doesn't need its own project such as cloned repositories.
Last updated: 2020-09-19

Home alienwesley wiki (WikiPage)
This is the personal project of alienwesley. This project is created automatically during user registration as an easy place to store personal data that doesn't need its own project such as cloned repositories.
Last updated: 2020-09-19

wiki Discussion alienwesley wiki (Discussion)
Forum for wiki comments
Last updated: 2020-09-19

blog Discussion alienwesley blog (Discussion)
Forum for blog comments
Last updated: 2020-09-19

(no subject) alienwesley wiki (Thread)
Last updated: 2020-09-19

wiki Discussion darrenredford wiki (Discussion)
Forum for wiki comments
Last updated: 2020-09-20

blog Discussion darrenredford blog (Discussion)
Forum for blog comments
Last updated: 2020-09-20

(no subject) darrenredford wiki (Thread)
Last updated: 2020-09-20

Home darrenredford wiki (WikiPage)
This is the personal project of darrenredford. This project is created automatically during user registration as an easy place to store personal data that doesn't need its own project such as cloned repositories.
Last updated: 2020-09-20

wiki Discussion janenalleman wiki (Discussion)
Forum for wiki comments
Last updated: 2020-09-20

blog Discussion janenalleman blog (Discussion)
Forum for blog comments
Last updated: 2020-09-20

Post by ingo on #19 Install missing libraries Scripting snippets (Post)
Description has changed: Diff: --- old +++ new @@ -35,8 +35,6 @@ proj = projects.primary # compile a regular expression to match lib placeholders p = re.compile(&#39;[^,]+, [^(]+\([^)]+\)&#39;) - # Breakpoint Logging Functions, 3.5.5.0 (3S - Smart Software Solutions GmbH) - # search for libman objects = proj.get_children(recursive=True)
Last updated: 2020-09-20

(no subject) Scripting snippets (Thread)
Last updated: 2020-09-20

Ticket #19: Install missing libraries Scripting snippets (Ticket)
Thanks @jelle for the ideas I got from snippet [#18]. But as the snippet from @jelle was not complete, yet, a lot of transfer knowledge was necessary to use it. So after I implemented it by myself, I thought, that I should add my version here also. It acts on the primary project. So you should open the project before calling this function. And it uses WebClient from DotNet, because the "request" module, which was referenced in [#18] was not available. import os, re from System.Net import WebClient # # Install a library from a URL (starting with http(s)) # def install_library(url, librarymanager): if not url.startswith("http"): return downloaddir = os.path.join(os.environ["USERPROFILE"], "downloads") if not os.path.exists(downloaddir): os.makedirs(downloaddir) basename, extension = os.path.splitext(url) localname = os.path.join(downloaddir, "dl" + extension) print("*** download %s to %s\n" % (url, localname)) web_client = WebClient() web_client.DownloadFile(url, localname) repo = librarymanager.repositories[0] print("*** installing %s\n" % url) librarymanager.install_library (localname, repo, True) # # search for missing libraries in current primary project # def install_missing_libraries(librarymanager): proj = projects.primary # compile a regular expression to match lib placeholders p = re.compile('[^,]+, [^(]+\([^)]+\)') # search for libman objects = proj.get_children(recursive=True) for object in objects: if object.is_libman: for libref in iter(object): if libref.is_placeholder: if libref.effective_resolution is None and libref.default_resolution is not None: libInfo = str(libref.default_resolution) m = re.findall('([^,]+), ([^(]+) \(([^)]+)\)', libInfo) if len(m) > 0: libname, libversion, libvendor = m[0] indexurl = "https://store.codesys.com/CODESYSLibs/%s/%s/%s/index" % (libvendor, libname, libversion) web_client = WebClient() try: filename = web_client.DownloadString(indexurl).rstrip() except: filename = None if filename != None: liburl = "https://store.codesys.com/CODESYSLibs/%s/%s/%s/%s" % (libvendor, libname, libversion, filename) install_library(liburl, librarymanager) The function can be called like this: install_missing_libraries(librarymanager) The variable "librarymanager" is implicitly available in python scripts, running in CODESYS.Install missing libraries Scripting 0 snippets Ticket tickets Install missing libraries 2020-09-20 19:27:40.626000 Unlicense False 0 ingo Ticket #19: Install missing libraries 0 False /tol/scripting/snippets/19/ ingo 2020-09-20 19:12:54.499000 None 19 scripting Thanks @jelle for the ideas I got from snippet [#18]. But as the snippet from @jelle was not complete, yet, a lot of transfer knowledge was necessary to use it. So after I implemented it by myself, I thought, that I should add my version here also. It acts on the primary project. So you should open the project before calling this function. And it uses WebClient from DotNet, because the "request" module, which was referenced in [#18] was not available. import os, re from System.Net import WebClient # # Install a library from a URL (starting with http(s)) # def install_library(url, librarymanager): if not url.startswith("http"): return downloaddir = os.path.join(os.environ["USERPROFILE"], "downloads") if not os.path.exists(downloaddir): os.makedirs(downloaddir) basename, extension = os.path.splitext(url) localname = os.path.join(downloaddir, "dl" + extension) print("*** download %s to %s\n" % (url, localname)) web_client = WebClient() web_client.DownloadFile(url, localname) repo = librarymanager.repositories[0] print("*** installing %s\n" % url) librarymanager.install_library (localname, repo, True) # # search for missing libraries in current primary project # def install_missing_libraries(librarymanager): proj = projects.primary # compile a regular expression to match lib placeholders p = re.compile('[^,]+, [^(]+\([^)]+\)') # search for libman objects = proj.get_children(recursive=True) for object in objects: if object.is_libman: for libref in iter(object): if libref.is_placeholder: if libref.effective_resolution is None and libref.default_resolution is not None: libInfo = str(libref.default_resolution) m = re.findall('([^,]+), ([^(]+) \(([^)]+)\)', libInfo) if len(m) > 0: libname, libversion, libvendor = m[0] indexurl = "https://store.codesys.com/CODESYSLibs/%s/%s/%s/index" % (libvendor, libname, libversion) web_client = WebClient() try: filename = web_client.DownloadString(indexurl).rstrip() except: filename = None if filename != None: liburl = "https://store.codesys.com/CODESYSLibs/%s/%s/%s/%s" % (libvendor, libname, libversion, filename) install_library(liburl, librarymanager) The function can be called like this: install_missing_libraries(librarymanager) The variable "librarymanager" is implicitly available in python scripts, running in CODESYS. False False 2
Last updated: 2020-09-20

Home janenalleman wiki (WikiPage)
This is the personal project of janenalleman. This project is created automatically during user registration as an easy place to store personal data that doesn't need its own project such as cloned repositories.
Last updated: 2020-09-20

(no subject) janenalleman wiki (Thread)
Last updated: 2020-09-20

<< < 1 .. 1155 1156 1157 1158 1159 .. 3700 > >> (Page 1157 of 3700)

Showing results of 92500

Sort by relevance or date