{"id":445,"date":"2018-11-27T15:46:08","date_gmt":"2018-11-27T14:46:08","guid":{"rendered":"https:\/\/letoon-lg.com\/?p=445"},"modified":"2018-11-29T16:40:37","modified_gmt":"2018-11-29T15:40:37","slug":"python-development-environment-eclipse-based-for-kodi","status":"publish","type":"post","link":"https:\/\/letoon-lg.com\/index.php\/2018\/11\/27\/python-development-environment-eclipse-based-for-kodi\/","title":{"rendered":"Python Development Environment &#8211; Eclipse Based &#8211; for Kodi"},"content":{"rendered":"<p>Today, I will describe the setup of a fully usable development environment for Kodi, based on Python 2.7.15 SDK and Eclipse, in 5 steps which will take approximately 15 min.<\/p>\n<p><!--more--><\/p>\n<p>Then, let&#8217;s start with the Python install. Please download the Python 2.7.15 on the official web site:&nbsp;<a href=\"https:\/\/www.python.org\/downloads\/release\/python-2715\/\">https:\/\/www.python.org\/downloads\/release\/python-2715\/<\/a><\/p>\n<h2><strong><span style=\"text-decoration: underline;\">Step #1 &#8211; Python 2.7.15 install<\/span><\/strong><\/h2>\n<p>Kodi, in its latest official release 17, is embedding Python 2.7.15. Currently, it is not compatible with Python 3.x. It will be one of the major improvements of the next future development release 19 (not yet started). But for all developers, it is a huge challenge, because most of the thousands of Kodi mods and plugins shall be migrated to Python 3.x&#8230; it shall be done for 2020, not before.<\/p>\n<p>Choose the right version for your system, in my case the 64bits version for Windows.&nbsp;Then, install it by executing the setup. I suggest to use a directory in the root. Such as <em><strong>c:\\Python27<\/strong><\/em> for Windows.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-450\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-PythonVersion-1024x313.png\" alt=\"\" width=\"840\" height=\"257\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-PythonVersion-1024x313.png 1024w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-PythonVersion-300x92.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-PythonVersion-768x235.png 768w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-PythonVersion-1200x367.png 1200w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-PythonVersion.png 1787w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-448\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Python-300x222.png\" alt=\"\" width=\"300\" height=\"222\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Python-300x222.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Python.png 414w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<h2><span style=\"text-decoration: underline;\">Step 2 # &#8211; Python added to the PATH environment variable<\/span><\/h2>\n<p>The next step is to add Python in the PATH.<\/p>\n<p>On Windows 10, go to the search bar and enter &#8220;path&#8221;, then choose &#8220;Update environment variables&#8221; if the menu. Then, in System Properties\/Advanced Parameters click on Environment Variables and in&nbsp;In System Variables, update the PATH variable,&nbsp;by adding the paths for Python. In my case <em><strong>c:\\Python27<\/strong><\/em> and <em><strong>c:\\Python27\\Scripts\\<\/strong><\/em> . This last directory will contain all required and additional Python libs and modules.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-449\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Env.png\" alt=\"\" width=\"363\" height=\"472\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Env.png 607w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Env-231x300.png 231w\" sizes=\"auto, (max-width: 363px) 100vw, 363px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-453\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPath.png\" alt=\"\" width=\"492\" height=\"265\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPath.png 848w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPath-300x162.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPath-768x414.png 768w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-454\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPathUpdate.png\" alt=\"\" width=\"491\" height=\"238\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPathUpdate.png 686w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPathUpdate-300x145.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/p>\n<p>Additionally, we also have to create a new system environment variable called <em><strong>PYTHONPATH<\/strong><\/em>. its value must be the root directory of Python, in my case my <strong><em>c:\\Python27<\/em><\/strong> folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-464\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPythonPath.png\" alt=\"\" width=\"497\" height=\"228\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPythonPath.png 852w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPythonPath-300x137.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-EnvPythonPath-768x352.png 768w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/p>\n<p>validate all changes, and normally, Python should be usable. Try opening the standard editor, called IDLE (search bar or c:\\Python27) or open a shell (cmd in the search bar) and enter the command <strong><em>python &#8211;version<\/em><\/strong>. It should display the version 2.7.15.<\/p>\n<h2><span style=\"text-decoration: underline;\">Step #3 &#8211; Eclipse install<\/span><\/h2>\n<p><a href=\"https:\/\/www.eclipse.org\/\">Eclipse<\/a> is a versatile Integrated Development Environment, fully customizable with additional modules. May be a bit complex, but very powerful. Don&#8217;t be afraid, in our case, we will use only 2% of Eclipse capabilities.<\/p>\n<p>Let&#8217;s start by downloading the right Eclipse version. The latest, as of today, is the version 4.9. called Kepler. Choose the right one for your operating system, and also a &#8220;pre-packaged&#8221; version.<\/p>\n<p>I recommend to choose the version for Java Developers, because it contains the minimal set of useful tools, such as a Git integration (we could speak about it later).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-457\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse01-1024x379.png\" alt=\"\" width=\"840\" height=\"311\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse01-1024x379.png 1024w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse01-300x111.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse01-768x284.png 768w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse01-1200x444.png 1200w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse01.png 1346w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>After the download, you have an archive to deploy to a useful location. I suggest the root <em><strong>c:\\<\/strong><\/em> for Windows, as for the previous Python install. And that&#8217;s all&#8230; Eclipse is installed. Simple, isn&#8217;t it? At this stage, you can start Eclipse (executable file <em><strong>eclipse.exe<\/strong> <\/em>in the eclipse folder for Windows).<\/p>\n<h2><span style=\"text-decoration: underline;\">Step #4 &#8211; Python add-on for Eclipse &#8211; PyDev<\/span><\/h2>\n<p>Because our Eclipse is the package for Java development, we have to install an additional plugin for Python environment, called <a href=\"http:\/\/www.pydev.org\/\">PyDev<\/a>. Very simple, actually.&nbsp;Go to the menu <em><strong>Help<\/strong> <\/em>and&nbsp; choose <em><strong>Eclipse Marketplace<\/strong><\/em> and enter&nbsp;<em><strong>PyDev<\/strong><\/em>. Then install it, by confirmed the two features to install:&nbsp;<em><strong>PyDev for Eclipse<\/strong><\/em> and&nbsp;<em><strong>PyDev Mylyn Integration<\/strong><\/em>. Normally, the installation should find your Python path.<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-459\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse02.png\" alt=\"\" width=\"447\" height=\"415\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse02.png 575w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse02-300x279.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-461\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse03-1024x559.png\" alt=\"\" width=\"840\" height=\"459\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse03-1024x559.png 1024w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse03-300x164.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse03-768x419.png 768w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse03-1200x655.png 1200w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse03.png 1382w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-462\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse04.png\" alt=\"\" width=\"688\" height=\"154\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse04.png 688w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Eclipse04-300x67.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/p>\n<h2><span style=\"text-decoration: underline;\">Step #5 &#8211; Python hello World<\/span><\/h2>\n<p>Now, everything should be ok. Eclipse environment contains many pre-configured environments, called &#8220;Perspectives&#8221;. In our case, we will swith to the Python perspective.<\/p>\n<p>Go to the menu Window, and choose an other perspective: PyDev. Later, you will be able to directly access to this perspective by clicking on one of the top right (very small) icon for the PyDev perspective.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-467\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Perspective01.png\" alt=\"\" width=\"725\" height=\"384\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Perspective01.png 725w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Perspective01-300x159.png 300w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-469\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Perspective03.png\" alt=\"\" width=\"361\" height=\"140\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Perspective03.png 361w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-Perspective03-300x116.png 300w\" sizes=\"auto, (max-width: 361px) 100vw, 361px\" \/><\/p>\n<p>Now, let&#8217;s create a new PyDev project, named <em><strong>HelloWorld<\/strong><\/em>. If the Interpreter is not configured with python1, configure it with the path where you installed Python.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-477\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello01.png\" alt=\"\" width=\"722\" height=\"167\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello01.png 722w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello01-300x69.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-472\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello02.png\" alt=\"\" width=\"845\" height=\"969\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello02.png 845w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello02-262x300.png 262w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello02-768x881.png 768w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-473\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello03-1024x856.png\" alt=\"\" width=\"840\" height=\"702\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello03-1024x856.png 1024w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello03-300x251.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello03-768x642.png 768w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello03.png 1059w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>Let&#8217;s&nbsp; create our 1st Python script. We can do this with the contextual menu <em><strong>New\/File<\/strong><\/em> on the project <em><strong>HelloWorld<\/strong><\/em>.&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-474\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello04.png\" alt=\"\" width=\"931\" height=\"321\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello04.png 931w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello04-300x103.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello04-768x265.png 768w\" sizes=\"auto, (max-width: 931px) 100vw, 931px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-475\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello05.png\" alt=\"\" width=\"849\" height=\"313\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello05.png 849w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello05-300x111.png 300w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello05-768x283.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/p>\n<p>Enter a name, e.g. <em><strong>hello.py<\/strong><\/em> then validate.&nbsp;At last, enter the following code: <em><strong>print(&#8220;Hello World&#8221;)<\/strong><\/em> and save (CTRL-S).<\/p>\n<p>At last, you can execute your script, by clicking on the Run button in the tool bar. You should see &#8220;Hello World&#8221; in the console.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-476\" src=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello06.png\" alt=\"\" width=\"662\" height=\"232\" srcset=\"https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello06.png 662w, https:\/\/letoon-lg.com\/wp-content\/uploads\/2018\/11\/DevEnvInstall-hello06-300x105.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/p>\n<p>Bravo ! You ended the setup of the Python \/ Eclipse environment.<\/p>\n<p>The next stage will be very different: start playing with Watson Assistant!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, I will describe the setup of a fully usable development environment for Kodi, based on Python 2.7.15 SDK and Eclipse, in 5 steps which will take approximately 15 min.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[37],"tags":[30,38,25],"class_list":["post-445","post","type-post","status-publish","format-standard","hentry","category-programming","tag-eclipse","tag-pydev","tag-python"],"_links":{"self":[{"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/posts\/445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/comments?post=445"}],"version-history":[{"count":19,"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/posts\/445\/revisions"}],"predecessor-version":[{"id":489,"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/posts\/445\/revisions\/489"}],"wp:attachment":[{"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/media?parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/categories?post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letoon-lg.com\/index.php\/wp-json\/wp\/v2\/tags?post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}