Fix Python 3.12 Segmentation fault (Core dumped) in Ubuntu

Firefly A beautiful bug sitting on a Python, looking at the camera curiously. 20118

The user experienced a 'Segmentation fault (Core dumped)' error after installing and running Python 3.12 in Ubuntu. The problem was Python's standard library 'readline' crashing. The issue was resolved by installing libreadline-dev and recompiling Python 3.12 from the source.

Tiny Django Tips – Use cycle instead of boring “if else” in template tags

Use of Cycle in Django Template

Often we need to do alternate things in every steps of a django template for loop while doing things in a loop in a django template. For example, let's say you want to create a widget similar to the following image widget - to show various job types In this example, The Job Type widget…

How to read Data Matrix using Python in Linux

In this article, I'm going to introduce you to an interesting python module named pylibdmtx! This library is written based on the libdmtx library. You can install it in Ubuntu by using the following command: sudo apt install libdmtx0a Now that you have the library installed let's install pylibdmtx. I'm assuming you already have python…

How to download a file from a website link using Python script or, code snippet

How to download files using python

In this article, I’m going to demonstrate some code snippets that you can utilize to download files from the Internet using Python. Before we begin, you might be wondering why go through all the hassles of writing scripts to download files when you can simply click and download it by opening it on a browser!…

How to Check Web page for SEO Using Python

Banner vector created by macrovector - www.freepik.com

Website SEO aka Search Engine Optimization is important for every modern website. However manually validating SEO criteria is quite cumbersome. It is possible to automate most of the SEO checks using python. In this article, I'm going to demonstrate some ideas using basic python code snippets. These scripts will work as a good starting point…

কিভাবে পাইথনের বেসিকস শিখবো?

বেসিক থেকে ইন্টারমিডিয়েট লেভেলের পাইথন প্রোগ্রামার হিসেবে নিজেকে গড়ে তোলা শুরুতেই বলে রাখি, কোন প্রোগ্রামিং ল্যাঙ্গুয়েজ আয়ত্ত করা সোজা কথা না। কারণ, আমি নিশ্চিতভাবেই বলতে পারি, প্রোগ্রামিং এর বিভিন্ন নতুন কনসেপ্ট গুলো বুঝে আত্মস্থ করা এবং সেটাকে কাজে লাগানো অনেক কঠিন, এটাই স্বাভাবিক তা না হলে আপনি অবশ্যই গিফটেড ;)। যদি সি এস ই বা কম্পিউটার সায়েন্স…

Python Nested List Comprehension for…in goes from left to right!

The Confusion Scenario: You were asked to write the equivalent list comprehension of the following code: for i in range(6): for j in range(i): j Before, starting with the above one we try the simplest one: t = [] for i in range(6): t.append(i**2) We already know the syntax of list comprehension is as follows: expression…

Making a Stand Alone Executable from a Python Script using PyInstaller

There are plenty of tools available for converting python script into executable. For example, check out: PyInstallerpy2exe For Python 2, I used to prefer py2exe. It is a neat tool that does the trick by making a stand alone executable from python script. The one problem I faced was, py2exe used to support only python 2! Then I moved on to…

How to take Password input in Python

Did you know? There is a python module in Python Standard Library called getpass. The purpose of this library is to securely take input from user! The module is very handy for sensitive inputs such as passwords / keys or any kind of credentials. Simplest example of getpass could be this: import getpass password =…

When to use Abstract Class in Python?

In this article, I would like to answer a common question that pops up in mind whenever we start to learn Object Oriented Programming in Python.  But before we begin exploring the use case, first lets briefly discuss about what really is an abstract class in python: Abstract Class Abstract Class is a class that…