Learn Technology What you really want

The future is closer than you think. You can pay attention now or watch the transformation happen right in front of your eyes.

Close

Things you should know to run Python Programs

Posted on December 20th, 2019 Python Journals

An Overview

I will give you a small hint about basics that you should know before we jump on to this topic. 

You should know the following if you want to run python programs.

  • Python Interpreter is a program that runs the python programs you write. 
  • Source code which would be the statements that you write for your program. We write this source code in a text file that normally ends with .py extension. 
  • Byte Code is the lower level of your program after python compiles it. Python stores byte code in files with.pyc extension.
  • Python Virtual Machine (PVM) is the runtime engine of Python that interprets your compiled byte code.
  • Pysco, shed skin and frozen binaries are all variations on the execution model. CPython is the standard implementation of the language. Jython and IronPython implement python programs for use in Java and ,NET environments.
  • Stackless is an enhanced version of Python aimed at concurrency and pypy is a reimplementation of python targeted at speed.

With these basics, we can move on to things you should know that is important to run python programs.

python programs

How do you run Python Programs?

There are different ways to execute python code and i will be covering few of these approaches in this blog. It’s important for anyone to understand the Python Program’s architecture and IDLE. You should know how to run the code in an interactive way and also save it in files that can be executed in different ways. System command lines, icon clicks, module imports, exec calls, menu options in IDLE GUI are some of the things you should know.

Interactive Prompt

The simplest way to run python programs is to type them at Python’s interactive command line  and we have a variety of approaches to start this command line which is also referred to as Interactive Prompt. The Notion of a system shell prompt is generic and it varies by platform.

On windows, you can type python in a DOS console window which is referred to as command prompt. You should know the basic commands that will be used in command prompt.

On Mac OS X, you can start a Python interactive interpreter by  clicking on Applications->Utilities->Terminal and type python in the window that opens up. And you might type this command in a shell in Linux platform.

You can type any python statement or expression here and run it immediately. Depending on your Python version and platform, You may need to replace python with full path to Python executable on your machine. You should know what the PATH is and how to set it. Python 3.3 Programs installs the windows launcher in auto mode and you dont require a directory path to run python commands nowadays. The main benefit of the interactive prompt is that it runs python programs and displays results in an immediate mode. And moreover interactive prompt turns out to be a great place to experiment with the language and test program files.

System command Lines and Files

Though Interactive prompt is great with what it has, it has disadvantages too. One is that the programs you type will be wiped off the moment from the screen when python interpreter completes executing them. There are features like cut and paste, command recall might help but not useful when you write larger python programs. In order to save programs, you have to write the code in files which are known as modules. Modules are nothing but text files that contain python statements. Python executes all the code in a module file from top to bottom each time you run the file. 

Unix Style Executable Scripts

If you are going to use python on a Unix, Linux or Unix-like system, you can also turn files of python code into executable programs. Unix style executable scripts are normal text files that contain python statements but with two special properties.

Scripts usually start with a line that begins with characters #! Followed by path to python interpreter on your machine.

Script files get marked as executable to tell the OS that they may run as top level programs.

File icon Clicks

Icon clicks are supported on most platforms in one form or another. There are different types of icon clicks and are listed below.

  • Windows icon clicks
  • Non windows icon clicks

Windows icon clicks: Registry makes opening files easy in windows. Python uses file name associations to get registered as a program that opens python program files when they are clicked. In that way, it is easy to launch the python programs you write by a simple click on their file icons.

Non windows icon clicks: You might feel it different comparing file icons that you see in windows as the GUI experience for the user and the way we operate the non windows systems is completely different. On some Linux and Unix systems, you need to register .py extension with your file explorer GUI.

The IDLE User Interface

IDLE offers a graphical user interface for doing python development and it’s a standard and free part of the Python system. IDLE is usually referred to as integrated development environment (IDE), because it binds together various development task in to single view. It runs on all platforms and represent an easy to use alternative to typing command lines or clicking icons.

I hope this information would be useful for python programmers or anyone who wants to learn python Programs.

I will post more blogs in the coming days.

Related Posts

Why ReactJS is best for web Development?

ReactJS is Best for Web Development -> Do you agree? Hello Coders! Welcome to my blog. I have discussed some strong points here that will help you understand why ReactJS is best for web development. I got a chance to work in REACT after 8 years of coding in different . .

Top Technologies to learn in 2020

Top IT technologies that you should focus in 2020 Looking for a career Change in IT. We all know that IT is going through a transformation phase and it’s our responsibility to align our skills with market expectations which many of them are not doing it. We continue to work . .

December 20, 2019

General Blogs

Key Important Java frameworks that is important

An Overview Java Framework – You will find some important java frameworks in this blog. Java is a powerful programming language, because it is Object Oriented, High level and Platform independent programming language. And as a Java developer everyone would like to write a blog on its unique features. Here . .

Facebook
Instagram
Twitter
Linkedin
YouTube

Nearby Locations: Ramapuram, DLF IT Park, Valasaravakkam, Adyar, Adambakkam, Anna Salai, Ambattur, Ashok Nagar, Aminjikarai, Anna Nagar, Besant Nagar, Chromepet, Choolaimedu, Guindy, Egmore, K.K. Nagar, Kodambakkam, Ekkattuthangal, Kilpauk, Medavakkam, Nandanam, Nungambakkam, Madipakkam, Teynampet, Nanganallur, Mylapore, Pallavaram, OMR, Porur, Pallikaranai, Saidapet, St.Thomas Mount, Perungudi, T.Nagar, Sholinganallur, Triplicane, Thoraipakkam, Tambaram, Vadapalani, Villivakkam, Thiruvanmiyur, West Mambalam, Velachery and Virugambakkam.

Copyrights © 2024 Bit Park Private Limited · Privacy Policy · All Rights Reserved · Made in BIT Park Pvt Ltd