How to fix Error Permission denied:’/dev/input/eventX’ running kivy app in Linux

On running a Python script in vscode with the kivy package, the error of Permission denied:'/dev/input/eventX' appears, where X is a number. To correct this error, open a terminal window and enter the following command: $ sudo chmod u+r /dev/input/eventX <enter> Above is only for one time execution. Error will repeat again if code is … Continue reading How to fix Error Permission denied:’/dev/input/eventX’ running kivy app in Linux

How to fix error in vscode of “kivy.uix.label” could not be resolved

This error can be overcome by selecting the right python environment by clicking next to Python in the status bar of vscode. The Python application was running the global python environment where kivy was not installed. After changing to pipenv of the project as per image below in vscode, it worked.

How to create a python virtual environment for a project in Linux

Python interpreters can be installed globally system-wide or as a virtual environment within a project folder. The advantage of within a virtual environment is isolation of the packages from system-wide use and execution. To set up a virtual environment for a project, open a terminal window and enter the following commands: $ sudo apt-get install … Continue reading How to create a python virtual environment for a project in Linux

The Quest for A Good IDE for Python Coding on Linux

In order to write code or learn programming or coding in Python, a good IDE was needed to take out the pain from looking up functions, keywords and more. The short list below were tried out before finally choosing one that best suited the purpose. Geany Eclipse PyCharm Spyder vscode Whilst it made sense to … Continue reading The Quest for A Good IDE for Python Coding on Linux

How to convert PNG images in a directory to JPG using Python

To convert several PNG images to JPG images, the convert command in Linux was not good enough and gave errors. It seems it could not process the large volume of PNG files. Therefore, the image files were converted from PNG to JPG using Python using the following code. Before using the code, Python 3 gave … Continue reading How to convert PNG images in a directory to JPG using Python

How to replace line feeds in a text file with Python

The below Python code will replace line feeds in a text file with space or replace consecutive line feeds with one line feed. I named this replacelf.py. # file outtext in the current directory file_path = r"./outtext" # Note that the file has to be opened in binary mode. with open(file_path, "rb") as open_file: #read … Continue reading How to replace line feeds in a text file with Python

How to sort and rename files in Python on Linux and use tesseract OCR to extract text to a file

In order to convert a series of images with text as an image in them to text files, the best tool is tesseract. It is quite old, but very reliable when it comes to looking for and extracting text from images. After saving some screen shots as jpg files, it was found their names contained … Continue reading How to sort and rename files in Python on Linux and use tesseract OCR to extract text to a file

How to install python3 on Linux

Install python3 $ sudo apt-get install python3-pip python3-venv python3 <enter> Make an isolated environment$ mkdir environment <enter>$ cd environment <enter>$ python3 -m venv my_env <enter> where my_env is the isolated environment$ ls my_env <enter> to display the created folders Activate the isolated environment$ source ~/environment/my_env/bin/activate <enter> This will be the resulting prompt(my_env) patrick@rm01:~/environments$ Create a … Continue reading How to install python3 on Linux

Eclipse IDE and Python Development

Python is very easy to learn. However, for newbies, you need a code editor that allows you to view code completion. Code completion helps to develop and learn a new computer language rapidly and that is why, Eclipse is one of the most popular Integrated Development Environments (IDE) out there. To develop programs using Python … Continue reading Eclipse IDE and Python Development