Skip to content
Home ยป Software

Software

Rebuild an XLSX file in Python

I ran into a compatibility issue with the formatting in an Excel file. When I tried to open the file in a Python program using Pandas, as one does, I got the following error: ValueError: Colors must be aRGB hex values.

Very old versions of xlrd (version 1.2.0) can get around the color problem and open the file anyway, but Pandas requires version 2.0.1 or newer. I got around the problem by using an old xlrd to open the file and rebuild the file with a current version of xlsxwriter so Pandas could open the resulting file.

Read More »Rebuild an XLSX file in Python

Twitter vs Mastodon

Twitter’s instability over the course of 2022 caused an unprecedented number of people to seek alternatives. The alternative that appears to be the most viable is Mastodon, an open source social network with some clear similarities, but also notable differences. So let’s look at Twitter vs Mastodon, and I will provide some tips as someone who has started the migration.

Millions of people migrated to Mastodon in November 2022, a migration that rivaled the migration from Digg to Reddit in 2010. And much like how Reddit was like Digg in some ways but not others, Mastodon is like Twitter on the surface but has some differences that can be confusing at first.

Read More »Twitter vs Mastodon

What a sprite is

What is a sprite? Sprites are a concept in computer programming, primarily gaming, or at least primarily thought of as gaming related. But if you are reading this on a desktop or laptop computer, you just used a sprite to click on this link.

Read More »What a sprite is

f strings in Python

When you first encounter f strings in Python, they can seem like a dark art. And you can use them without understanding them. I’ve used f strings to get myself out of a bind, based on a code snippet I found on Stack Overflow or some other discussion board, with a comment saying not to ask me why it works. But here’s what they do and how they can help your code.

Read More »f strings in Python

What is recursion in Python? Here’s an example

Recursion in computer science is a subroutine that calls itself. So what is recursion in Python? The same thing. A function that calls itself.

Recursion is a concept that first or second semester computer science classes frequently cover, but it can be confusing. I will admit that I generally tried to avoid using it, but it can be useful. I especially find recursion in Python useful when working with APIs, which is a common Python use case.

Read More »What is recursion in Python? Here’s an example

ZIP vs RAR

ZIP and RAR are two popular file formats in the Windows world. They have similarities, since both of them provide lossless file compression. But they have some fairly significant technical and philosophical differences too. Here’s a look at ZIP vs RAR and why the two file formats have coexisted side by side for decades.

Read More »ZIP vs RAR

json.loads vs json.dumps in Python

Dealing with JSON is a common task when you’re coding in Python. Two functions you may use a lot without fully understanding them are json.loads and json.dumps. Let’s take a look at json.loads vs json.dumps, what they do, and how they can help you, especially when wrangling complex JSON data from APIs.

json.loads and json.dumps are two functions for converting JSON to and from simple strings. Sometimes one is better than the other, and being able to convert between them reduces the trade-offs you have to make.

Read More »json.loads vs json.dumps in Python

Make a Word hyperlink UNC path

I had an issue in a document with a hyperlink to an existing file. The file existed on a network drive, so the link worked fine… until someone with different drive mappings than me had to look at the document. Then the link didn’t resolve and the person got an error message. A confusing error message. It turns out it’s tricky to make a Word hyperlink UNC path.

Fixing it wasn’t as easy as it should have been.Read More »Make a Word hyperlink UNC path

Gzip vs Zip

Zip and gzip are two similarly named utilities, and they perform similar functions, but they are unrelated. They also have slightly different use cases. Let’s take a look at gzip vs Zip.

Simply speaking, Zip and gzip are implementations of the same compression algorithm for different operating systems, so they are similar but not exactly compatible. Zip originated with MS-DOS, while gzip originated with Unix-like operating systems, notably Linux.

Read More »Gzip vs Zip

Can’t type in PyCharm? Try this first.

PyCharm is a lifesaver for developing in Python, but it has a glitch. Sometimes, after you run a script, you lose the ability to type in the editor and make changes. Loads of web sites offer elaborate suggestions to fix the problem, but frequently, these complex solutions don’t work. Frequently they cause other problems. Try the easy solutions first.

The two easy solutions are to double-click on another file in your project, then double click on your script again. And if that doesn’t work, just exit PyCharm entirely and relaunch it.

Read More »Can’t type in PyCharm? Try this first.