{"id":3706,"date":"2019-03-25T17:45:35","date_gmt":"2019-03-25T20:45:35","guid":{"rendered":"http:\/\/xexeu.elipse.com.br\/pt\/executing-python-scripts-via-elipse-e3\/"},"modified":"2019-05-29T10:25:57","modified_gmt":"2019-05-29T13:25:57","slug":"executing-python-scripts-via-elipse-e3","status":"publish","type":"post","link":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/","title":{"rendered":"Executing Python scripts via Elipse E3."},"content":{"rendered":"<div align=\"justify\">\n<p>Python is a general-purpose programming language especially used for scientific and engineering solutions due to its several libraries for handling data, calculations, statistics, visualization, etc.<\/p>\n<p>Elipse E3 has no native support to this language; however, external applications can be executed via VBScript, with a command similar to Window&#8217;s Execute. For these purpose, you need to download the interpreter and the libraries used by the script. For further information, check out <a href=\"http:\/\/kb.elipse.com.br\/pt-br\/questions\/5340\/Instalando+Python+e+suas+bibliotecas+para+uso+integrado+ao+EPM.\" target=\"_blank\" rel=\"noopener noreferrer\">Instala\u00e7\u00e3o do Python para uso integrado ao EPM<\/a> (in Portuguese).<\/p>\n<p><u><b>Example 1<\/b><\/u>:\u00a0 Python code generating a bar chart with <a href=\"http:\/\/matplotlib.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Matplotlib<\/a> library, using the data received via command line arguments.<br \/>\n<span style=\"font-family: Courier New;\"><br \/>\n<\/span><\/p>\n<div align=\"left\"><span style=\"font-family: Courier New;\"><span style=\"color: #ff9900;\">import <\/span>sys<\/span><br \/>\n<span style=\"font-family: Courier New;\"><span style=\"color: #ff9900;\">import <\/span>numpy <span style=\"color: #ff9900;\">as <\/span>np<\/span><br \/>\n<span style=\"font-family: Courier New;\"><span style=\"color: #ff9900;\">import <\/span>matplotlib.pyplot <span style=\"color: #ff9900;\">as <\/span>plt<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">rs <span style=\"color: #ffcc00;\">=<\/span> sys.argv[<span style=\"color: #ff9900;\">1<\/span>]<\/span><br \/>\n<span style=\"font-family: Courier New;\">rj <span style=\"color: #ffcc00;\">=<\/span> sys.argv[<span style=\"color: #ff9900;\">2<\/span>]<\/span><br \/>\n<span style=\"font-family: Courier New;\">pr <span style=\"color: #ffcc00;\">=<\/span> sys.argv[<span style=\"color: #ff9900;\">3<\/span>]<\/span><br \/>\n<span style=\"font-family: Courier New;\">sp <span style=\"color: #ffcc00;\">= <\/span>sys.argv[<span style=\"color: #ff9900;\">4<\/span>]<\/span><br \/>\n<span style=\"font-family: Courier New;\">mg <span style=\"color: #ffcc00;\">=<\/span> sys.argv[<span style=\"color: #ff9900;\">5<\/span>]<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">estados <span style=\"color: #ffcc00;\">=<\/span> (<span style=\"color: #339966;\">&#8216;RS&#8217;<\/span>, <span style=\"color: #339966;\">&#8216;RJ&#8217;<\/span>, <span style=\"color: #339966;\">&#8216;PR&#8217;<\/span>, <span style=\"color: #339966;\">&#8216;SP&#8217;<\/span>, <span style=\"color: #339966;\">&#8216;MG&#8217;<\/span>)<\/span><br \/>\n<span style=\"font-family: Courier New;\">y_pos <span style=\"color: #ffcc00;\">=<\/span> np.arange(<span style=\"color: #ff9900;\">len<\/span>(estados))<\/span><br \/>\n<span style=\"font-family: Courier New;\">performance <span style=\"color: #ffcc00;\">=<\/span> [rs,rj,pr,sp,mg]<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">plt.barh(y_pos, performance, align=<span style=\"color: #339966;\">&#8216;center&#8217;<\/span>, alpha=0.4)<\/span><br \/>\n<span style=\"font-family: Courier New;\">plt.yticks(y_pos, estados)<\/span><br \/>\n<span style=\"font-family: Courier New;\">plt.xlabel(<span style=\"color: #339966;\">&#8216;Temp&#8217;<\/span>)<\/span><br \/>\n<span style=\"font-family: Courier New;\">plt.title(<span style=\"color: #339966;\">&#8216;Elipse E3&#8217;<\/span>)<\/span><br \/>\n<span style=\"font-family: Courier New;\">plt.show()<\/span><\/div>\n<p><u><b>Example 2<\/b><\/u>:\u00a0 VBScript code passing arguments and executing the program in Python.<\/p>\n<div align=\"left\"><span style=\"font-family: Courier New;\">temprs = Screen.Item(<span style=\"color: #ff0000;\">&#8220;spTempRS&#8221;<\/span>).Value<\/span><br \/>\n<span style=\"font-family: Courier New;\">temprj = Screen.Item(<span style=\"color: #ff0000;\">&#8220;spTempRJ&#8221;<\/span>).Value<\/span><br \/>\n<span style=\"font-family: Courier New;\">temppr = Screen.Item(<span style=\"color: #ff0000;\">&#8220;spTempRS&#8221;<\/span>).Value<\/span><br \/>\n<span style=\"font-family: Courier New;\">tempsp = Screen.Item(<span style=\"color: #ff0000;\">&#8220;spTempSP&#8221;<\/span>).Value<\/span><br \/>\n<span style=\"font-family: Courier New;\">tempmg = Screen.Item(<span style=\"color: #ff0000;\">&#8220;spTempMG&#8221;<\/span>).Value<\/span><\/p>\n<p><span style=\"font-family: Courier New;\"><span style=\"color: #0000ff;\">Dim <\/span>oShell<\/span><br \/>\n<span style=\"font-family: Courier New;\"><span style=\"color: #0000ff;\">Set <\/span>oShell = CreateObject(<span style=\"color: #ff0000;\">&#8220;WSCript.shell&#8221;<\/span>)<\/span><br \/>\n<span style=\"font-family: Courier New;\">oShell.run <span style=\"color: #ff0000;\">&#8220;grafico.py &#8220;<\/span>&#038;temprs&#038;<span style=\"color: #ff0000;\">&#8221; &#8220;<\/span>&#038;temprj&#038;<span style=\"color: #ff0000;\">&#8221; &#8220;<\/span>&#038;temppr&#038;<span style=\"color: #ff0000;\">&#8221; &#8220;<\/span>&#038;tempsp&#038;<span style=\"color: #ff0000;\">&#8221; &#8220;<\/span>&#038;tempmg,0<\/span><\/div>\n<p>The result is a pop-up window similar to the one below:<\/p>\n<div align=\"center\"><img loading=\"lazy\" title=\"\" src=\"http:\/\/kb.elipse.com.br\/pt-br\/images\/ID5393\/grafico.png\" alt=\"\" width=\"500\" height=\"423\" align=\"baseline\" border=\"0\" hspace=\"0\" \/><\/div>\n<p>Attached to this article is an application employing this example, with annotated code.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>Attachments:<\/h3>\n<p><a href=\"\/wp-content\/uploads\/2019\/03\/E3Python.zip\">E3Python.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python is a general-purpose programming language especially used for scientific and engineering solutions due to its several libraries for handling data, calculations, statistics, visualization, etc. Elipse E3 has no native&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0},"categories":[763],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Executing Python scripts via Elipse E3. - Elipse Knowledgebase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Executing Python scripts via Elipse E3.\" \/>\n<meta property=\"og:description\" content=\"Python is a general-purpose programming language especially used for scientific and engineering solutions due to its several libraries for handling data, calculations, statistics, visualization, etc. Elipse E3 has no native&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\" \/>\n<meta property=\"og:site_name\" content=\"Elipse Knowledgebase\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/elipsesoftware\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-25T20:45:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-29T13:25:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/kb.elipse.com.br\/pt-br\/images\/ID5393\/grafico.png\" \/>\n<meta name=\"author\" content=\"Lucas Kotres\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lucas Kotres\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\"},\"author\":{\"name\":\"Lucas Kotres\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379\"},\"headline\":\"Executing Python scripts via Elipse E3.\",\"datePublished\":\"2019-03-25T20:45:35+00:00\",\"dateModified\":\"2019-05-29T13:25:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\"},\"wordCount\":255,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\"},\"articleSection\":[\"Scripts\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\",\"url\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\",\"name\":\"[:pt]Executing Python scripts via Elipse E3.[:] - Elipse Knowledgebase\",\"isPartOf\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#website\"},\"datePublished\":\"2019-03-25T20:45:35+00:00\",\"dateModified\":\"2019-05-29T13:25:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/kb.elipse.com.br\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Executing Python scripts via Elipse E3.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kb.elipse.com.br\/#website\",\"url\":\"https:\/\/kb.elipse.com.br\/\",\"name\":\"Elipse Knowledgebase\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kb.elipse.com.br\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kb.elipse.com.br\/#organization\",\"name\":\"Elipse Software\",\"url\":\"https:\/\/kb.elipse.com.br\/\",\"sameAs\":[\"http:\/\/www.facebook.com\/elipsesoftware\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png\",\"contentUrl\":\"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png\",\"width\":161,\"height\":58,\"caption\":\"Elipse Software\"},\"image\":{\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379\",\"name\":\"Lucas Kotres\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/kb.elipse.com.br\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g\",\"caption\":\"Lucas Kotres\"},\"url\":\"https:\/\/kb.elipse.com.br\/en\/author\/kotres\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Executing Python scripts via Elipse E3. - Elipse Knowledgebase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/","og_locale":"en_US","og_type":"article","og_title":"[:pt]Executing Python scripts via Elipse E3.[:] - Elipse Knowledgebase","og_description":"Python is a general-purpose programming language especially used for scientific and engineering solutions due to its several libraries for handling data, calculations, statistics, visualization, etc. Elipse E3 has no native&hellip;","og_url":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/","og_site_name":"Elipse Knowledgebase","article_publisher":"http:\/\/www.facebook.com\/elipsesoftware","article_published_time":"2019-03-25T20:45:35+00:00","article_modified_time":"2019-05-29T13:25:57+00:00","og_image":[{"url":"http:\/\/kb.elipse.com.br\/pt-br\/images\/ID5393\/grafico.png"}],"author":"Lucas Kotres","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lucas Kotres","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#article","isPartOf":{"@id":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/"},"author":{"name":"Lucas Kotres","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379"},"headline":"Executing Python scripts via Elipse E3.","datePublished":"2019-03-25T20:45:35+00:00","dateModified":"2019-05-29T13:25:57+00:00","mainEntityOfPage":{"@id":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/"},"wordCount":255,"commentCount":0,"publisher":{"@id":"https:\/\/kb.elipse.com.br\/#organization"},"articleSection":["Scripts"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/","url":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/","name":"[:pt]Executing Python scripts via Elipse E3.[:] - Elipse Knowledgebase","isPartOf":{"@id":"https:\/\/kb.elipse.com.br\/#website"},"datePublished":"2019-03-25T20:45:35+00:00","dateModified":"2019-05-29T13:25:57+00:00","breadcrumb":{"@id":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kb.elipse.com.br\/en\/executing-python-scripts-via-elipse-e3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/kb.elipse.com.br\/en\/"},{"@type":"ListItem","position":2,"name":"Executing Python scripts via Elipse E3."}]},{"@type":"WebSite","@id":"https:\/\/kb.elipse.com.br\/#website","url":"https:\/\/kb.elipse.com.br\/","name":"Elipse Knowledgebase","description":"","publisher":{"@id":"https:\/\/kb.elipse.com.br\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kb.elipse.com.br\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/kb.elipse.com.br\/#organization","name":"Elipse Software","url":"https:\/\/kb.elipse.com.br\/","sameAs":["http:\/\/www.facebook.com\/elipsesoftware"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/","url":"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png","contentUrl":"https:\/\/kb.elipse.com.br\/wp-content\/uploads\/2019\/05\/schererelipse-com-br\/logoElipse.png","width":161,"height":58,"caption":"Elipse Software"},"image":{"@id":"https:\/\/kb.elipse.com.br\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/e57d707c58cf7aa3231eb5fdcc2ec379","name":"Lucas Kotres","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kb.elipse.com.br\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/faa3c53fb2e8ab0c35c4b8c90a691931?s=96&d=mm&r=g","caption":"Lucas Kotres"},"url":"https:\/\/kb.elipse.com.br\/en\/author\/kotres\/"}]}},"_links":{"self":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/3706"}],"collection":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/comments?post=3706"}],"version-history":[{"count":2,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/3706\/revisions"}],"predecessor-version":[{"id":6668,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/posts\/3706\/revisions\/6668"}],"wp:attachment":[{"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/media?parent=3706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/categories?post=3706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.elipse.com.br\/en\/wp-json\/wp\/v2\/tags?post=3706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}