{"id":6392,"date":"2019-08-27T11:08:00","date_gmt":"2019-08-27T11:08:00","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=6392"},"modified":"2019-08-27T11:08:00","modified_gmt":"2019-08-27T11:08:00","slug":"introduction-python-script-basics","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/","title":{"rendered":"{Introduction} &#8211; Python script basics"},"content":{"rendered":"<p>The article provides important information about using Python on MilesWeb hosting servers.<\/p>\n<h2># Permissions required to set the Python script files<\/h2>\n<p>Choosing the correct permissions for Python script files depends on the script&#8217;s particular function :<\/p>\n<p>To use Python CGI script files that can be publicly accessible through the web, you need to set the file permissions to 755 (i.e. read, write and execute permissions for the user. Also read and execute permissions for the group and world). You don&#8217;t have to provide the world write permission to the Python script.<\/p>\n<p>To use Python script files that you only run on the command line, you need to set the file permission to 700 (i.e. read, write and execute permissions for the user and there is no need of any permission for the group and world.)<\/p>\n<h2># File extensions that can be used for Python script files<\/h2>\n<p>Python script files have a .py or .cgi extension. However, with the file permissions, the file extension that you use generally, depends on the script&#8217;s function:<\/p>\n<p>The Python script files that generate the web output accessible to the public use the .cgi extension.<br \/>\nThe Python script files that you run only through the command line, and script files which do not generate web output, should use the .py extension.<\/p>\n<h2># Find out the Python version installed on MilesWeb hosting server<\/h2>\n<p>To determine which Python version is set as default on the server, type the following command :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">python -V<\/pre>\n<h2># Find a path to the Python executable<\/h2>\n<p>The absolute path to the default Python executable on MilesWeb hosting servers is <strong>\/usr\/bin\/python<\/strong>. Generally, you don&#8217;t have to include the full path when you run Python scripts from the command line, because the <strong>\/usr\/bin<\/strong> <strong>directory<\/strong> is set in the default path. To do this, type the following command :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">python filename<\/pre>\n<h2># To run different Python versions<\/h2>\n<p>There are many different versions of Python available. You can view the Python version available on your server by the following command :<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">ls \/usr\/bin\/python*<\/pre>\n<p>For example, if you want to run a script using Python version 3, then type the following command.<\/p>\n<pre class=\"trim-whitespace:false lang:default decode:true \">python3 filename<\/pre>\n<p>Replace filename with your script file name.<\/p>\n<p><strong>Also Read :<\/strong><\/p>\n<p><strong>1) <a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-perl-script-basics\/\">{Introduction} \u2013 Perl Script Basics<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The article provides important information about using Python on MilesWeb hosting servers. # Permissions required to set the Python script files Choosing the correct permissions for Python script files depends on the script&#8217;s particular function : To use Python CGI script files that can be publicly accessible through the web, you need to set the [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[931,966],"class_list":["post-6392","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-web-hosting-faq","tag-python","tag-python-script"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>{Introduction} - Python script basics - Web Hosting FAQs by MilesWeb<\/title>\n<meta name=\"description\" content=\"Learn basic Python script.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"{Introduction} - Python script basics - Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"og:description\" content=\"Learn basic Python script.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-27T11:08:00+00:00\" \/>\n<meta name=\"author\" content=\"Sonam Wagh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sonam Wagh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/\",\"name\":\"{Introduction} - Python script basics - Web Hosting FAQs by MilesWeb\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2019-08-27T11:08:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\"},\"description\":\"Learn basic Python script.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"{Introduction} &#8211; Python script basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\",\"name\":\"Sonam Wagh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g\",\"caption\":\"Sonam Wagh\"},\"description\":\"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/sonam\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"{Introduction} - Python script basics - Web Hosting FAQs by MilesWeb","description":"Learn basic Python script.","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:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/","og_locale":"en_GB","og_type":"article","og_title":"{Introduction} - Python script basics - Web Hosting FAQs by MilesWeb","og_description":"Learn basic Python script.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2019-08-27T11:08:00+00:00","author":"Sonam Wagh","twitter_misc":{"Written by":"Sonam Wagh","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/","name":"{Introduction} - Python script basics - Web Hosting FAQs by MilesWeb","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2019-08-27T11:08:00+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4"},"description":"Learn basic Python script.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/introduction-python-script-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"{Introduction} &#8211; Python script basics"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4","name":"Sonam Wagh","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g","caption":"Sonam Wagh"},"description":"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/sonam\/"}]}},"views":595,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=6392"}],"version-history":[{"count":1,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6392\/revisions"}],"predecessor-version":[{"id":6393,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/6392\/revisions\/6393"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=6392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=6392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=6392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}