Debian 10 - How to upgrade python 3.7 to python 3.9

I have covered this a number of times in the past and the posts have proved popular and useful to many. So, here is my guide for updating to the latest version of Python 3 (3.9) on Debian 10 Buster. To clarify the purpose of this guide, Debian 10 ships with Python 2 (2.7) and Python 3 (3.7) installed at my time of writing. For those wishing to upgrade from python 3.7.X to 3.8.X or 3.9.X, this is the guide for you. If you are trying to configure python 3.7 as your default interpreter when you call ‘python‘, try this: CHANGING THE DEFAULT PYTHON VERSION IN DEBIAN. This method involves using the ‘update-alternatives‘ command. We will be using a similar method in this guide, however this time we only do so to give 3.9.X a higher priority to 3.7.X, rather than uninstalling older versions. ...

January 5, 2021 · 3 min · Tom

Python 3 SSH with Paramiko

I have a number of projects which I am currently working on which usually involve a raspberry pi and so other TCP enabled object. One project, in particular, is to control a KVM server with buttons connected to a raspberry pi (follow on social media or RSS for that future post). I have been using Python 3 SSH with Paramiko to send commands KVM server from the pi. Here is how I do that… ...

May 15, 2020 · 3 min · Tom

How To: Python infinite loops with while true

Here is a quick guide on how to create an infinite loop in python using a ‘while true’ statement. There are number of reason that you might want to implement this; a great use case would be outputting a fluctuating variable to the terminal such as a temperature reading from a sensor. loops that make your brain hurt A ‘while true’ statement allows us to run a sequence of code until a particular condition is met. In order to make that sequence of code run in an infinite loop, we can set the condition to be one that is impossible to reach. Better still, we can simply omit the condition altogether to ensure that the while true loop never ends. ...

May 5, 2020 · 2 min · Tom

Python 2.7 end-of-life - The time to upgrade is upon us

1st January 2020 marked the official end of python 2.7 development, including feature support and security fixes. Python 2.7 was over 9 years old in development years, making it the longest supported version to date. The code freeze is no in place, with the final release – 2.7.18 – scheduled for an April 2020 release. So yes there will be one more version to come down the tubes but it’s probably best that the new python project you were thinking of starting is written in 3.7 or above. ...

January 5, 2020 · 2 min · Tom

Getting started with Python 3 - a beginner's cheat sheet

Python.Org I have been getting started with python 3 – I want to make this my primary scripting language. One way I like to assist myself whilst I learn the rope is to maintain a crib sheet filled with all the trivial things I would otherwise forget. Python 3 Cheat Sheet #Define Variables programming_languages: "Python", "VB", "C++", "C#" #Print Variables print(programming_languages) print('--------------------') #Basic for loop + variables for language in programming_languages: print(language) print('--------------------') #Basic Function def FuncExample(): i: 1 for language in programming_languages: #Concatinate Strings and Integers in print statements print("Language " + str(i) + ":" + language) #Increment Integer i += 1 FuncExample() print('--------------------') #Functions with Variables #1 - Strings def FuncVarExample1(fname, lname): #Print with CRLF print("First Name: " + fname + "\r\n" + "Last Name: " + lname) FuncVarExample1("Joe","Bloggs") print('--------------------') #Functions with Variables #2 - Integers + Returning Values def FuncVarExample2(x, y): #Basic integer maths return x+y #Concatenating Strings and Integers print("33 + 42: " + str(FuncVarExample2(33,42))) print('--------------------') You can also find more code snippets here: https://exitcode0.net/code-samples/ ...

November 23, 2019 · 1 min · Tom