This tutorial will run through using cpython on DSC machines.
Click on any image to view it in a lightbox.
For starters, let's get python to run the eponymous hello world program. The first thing to do is navigate to your preferred source code storage location, and write the hello world program.
Then, start the command prompt.
And then navigate to your program location.
Then, run the python interpreter.
At some point you may build up a code library that you would like to reference. Python contains options to ease the reuse of old code. In order to explore these options, lets compute the factorial of five. First, go to your prefered source directory, and write the program. The program is split up into two files: one that contains a factorial algorithm inside a module, and one that makes use of that module. The two files are split into disparate directories.
Start up the command prompt and navigate to the folder containing the main program. Now, whenever python runs, it searches for code libraries based on the environment variables PYTHONHOME and PYTHONPATH. In order for python to be able to find the factorial function, its folder must be on the PYTHONPATH. So, set the variable (on Windows, setting a variable in the command prompt only affects that command prompt).
Now just run the main program, and you should find that 5! = 120.