Error While Importing OpenAI ‘from openai import OpenAI’

The error message ImportError: cannot import name ‘OpenAI’ from ‘openai’ typically indicates a problem with installing the OpenAI library: most likely there’s a mismatch between the library and the Python version you’re using. Alternatively, you may simply have misspelled the case using OpenAi or Openai instead of OpenAI. Here’s a minimal code snippet where this … Read more

The Art of Clean Code — 14 Unix Principles

“This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. […] ” – McIlroy This book chapter draft is original material drawn from my book The Art of Clean Code (NoStarchPress, San Francisco). … Read more

(Solved) Python Request Error 403 When Web Scraping

Quick Fix Trying to parse a site when web scraping or calling APIs with Python requests, but getting slapped with a 403 Forbidden error. Ouch! The basic code looks like this: And the server is like, β€œNope, you’re not coming in” πŸ₯Έ, showing a 403 Forbidden error. Turns out, servers can be picky. They might … Read more

(Fixed) Python Request Error 500

When using Python’s requests library, encountering a 500 Internal Server Error indicates that the server has experienced an unexpected condition, preventing it from fulfilling the request. πŸ”§ Quick Fix: To solve a 500 error, start by examining the server-side logs for detailed error messages. If the server is within your control, review your server code … Read more

30 Everyday Human Tasks AI Can’t Replace in the Foreseeable Future

πŸ’‘ TLDR: Do you want to stay on the right side of change? Become an investor. Be reactive, i.e., if somebody needs something from you, give it to them. Embrace the little things that ChatGPT cannot do just yet. Be grateful you’re still needed. Most of us fear the same thing: AI taking on more … Read more

Let it snow()

The following script creates an animated snowfall effect in a terminal window. It continuously updates and displays snowflakes falling from the top of the terminal to the bottom. The snowflakes are represented by Unicode characters (feel free to change!) and their movement is simulated by updating their positions in a grid that represents the terminal … Read more

Mobile App Development with Python and Kivy: Your Guide to Building Apps Easily

Getting Started with Kivy and Python Embarking on your app development journey with Python can be an exciting venture, especially with the Kivy framework. Kivy is a free and open-source Python library that simplifies the process of building cross-platform applications. With this guide, you’ll set up your development environment and create your first basic application. … Read more