Pragmatism in the real world

Updating Flickr metadata using Python

I usually use my rodeo app to upload photos to Flickr, but for various reasons, I recently uploaded some photos directly via Flickr itself. One feature of rodeo that I really like is that it sets the date posted to be the same as date taken which means that they are ordered correctly in my photo stream. As this doesn't automatically, I knocked up a Python script to fix these photos for me. The key… continue reading.

Quick script to (re)create my python virtualenv

When working on rst2pdf, I use pyenv as I've written about before. Recently, I've found myself needing to recreate virtualenvs for various Python versions and then recreate them to easily reset the list of packages installed into them via pip. To my my life easier, I created a script that I can run from the command line: $ newenv rst2pdf-dev-py3.9 3.9.5 This creates a new virtualenv called rst2pdf-dev-py3.9 from Python version 3.9.5, upgrade pip and… continue reading.

Cannot find zlib headers on macOS 10.15 Catalina

My new MacBook Pro 16" comes with Catalina and while setting up Python to develop rst2pdf, I discovered that Pillow wouldn't install. Running setup.py install for pillow … error ERROR: Command errored out with exit status 1: Looking through the long list of red text I came across: The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Aha! The way this was solved on the… continue reading.

Creating virtual environments with Pyenv

rst2pdf is a Python 2 application that we're making compatible with Python 3. When developing Python applications, I've found it useful to be able to switch python versions easily and also set up clean environments to work in. To do this, I currently use pyenv. This is how I set it up: Install Pyenv On my Mac, I install pyenv & its sister project pyenv-virtualenv with Homebrew: $ brew install readline xz $ brew install… continue reading.

Step debugging sphinx-build in PyCharm

I've been trying to solve an issue with the rst2pdf Sphinx extension which allows you to use rst2pdf to create a PDF of your Sphinx documentation rather than using Sphinx's default pdfTeX builder. In order to understand what was happening, I really wanted to inspect variable at certain stages of the process, which is easiest with a step debugger. As I already use PhpStorm for step debugging PHP, I fired up PyCharm and worked out… continue reading.