A Learning Use Case for the Black Python Code Formatter

Black is a code formatting tool that I have been testing out recently to see what the hype is about. It is the defacto “uncompromising code formatter in Python”. I normally do not use any code formatters since I’m not required to use them. This short post aims to convince you that Black is an […]

Write More Code, Write Less Code

Write More Code Write code everyday. Code fast and break things. Cherish your tracebacks. Keep going back, no matter how hopeless it may seem. Code habitually. Learn how to code. Get better at code. Love code. Write Less Code Use as few lines as possible. Nothing looks better than a program shorter than 50 or […]

8 Promising Python Static Site Generators

A static site generator creates static HTML and markdown files to serve as a website. They’re commonly used to host blogs but not exclusively. I recently researched my options to roll a static site in Python. I’m assessing a few of them as a potential future self-hosted blogging solution for this WordPress blog. Or maybe […]

Python Requests SSLCertVerificationError Solution for Windows

I initially installed my Python version from the Windows Store and it worked fine for almost a year on my Windows 10 computer. Then I started getting this error message when trying to use the requests library on all HTTP requests: requests.exceptions.SSLError: HTTPSConnectionPool(host=’api.example.com’, port=443): Max retries exceeded with url: /oauth/token?grant_type=client_credentials (Caused by SSLError(SSLCertVerificationError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] […]

How to Check if a Python Variable is a Tuple

Tonight I Googled “how to check if a variable is a tuple”, expecting to find a Stack Overflow isinstance() snippet. Instead, I found that i could use Python’s type built-in to check if my variable is a tuple: I thought that looked like a good solution until I found a section in PEP 8, Python’s […]

Did You Read the Whole Error?

You read the whole thing front to back? Every word? Stop and think about it. What is the computer trying to tell you? Sometimes something is obvious but needs to be reminded. I found myself thinking this yet again today. Often there are times where I would have saved some time and grief by carefully […]

Aggregating A Python Error Summary from Log Files

Follow these steps to maintain more reliable scripts and catch more of your traceback errors: automate your scripts to run daily, weekly, monthly, etc. Log all your traceback errors with the logging module. I like dumping all of my logs into a single folder. automate aggregating the logs and parsing tracebacks start a feedback loop […]