Leaving DuckDuckGo... sort of

06 Aug, 2022

This is a weird one. DDG has been my search engine of choice for a number of years, so I also used it as the search engine for this site (since it's statically generated). At some point over the last 3 (I think) months it stopped working - returning no results for any search criteria. Given Bing provides at least some percentage of DDG's content, I went digging in Bing's webmaster tools and found this...

bing webmaster tools - screenshot 1

(The inspected URL is known to Bing but has some issues which are preventing indexation)

There were a few errors reported but nothing that seems like a major issue (missing "description" meta, etc), and the indexation issue is even more confounding when you click on the Live Url and see...

bing webmaster tools - screenshot 2

(URL can be indexed by Bing)

I fixed some of the most egregious errors, tried getting it to re-index, but regardless, nothing is searchable in DDG...


And nothing in Bing...


But it seems Google has no problem...


As a consequence, I've re-pointed the site search at google search, until I can figure something else out (perhaps Lunr?), but for the moment it seems like I don't exist in my search engine of choice. Sigh.

Python for Kids 2 and LaTeX

30 Jul, 2022

For those who are interested, Python for Kids 2 has been completely rewritten as LaTeX (using No Starch's style); partially in text files, and partially in Overleaf:


Overleaf was great, particularly for the review process, but I have to say working in LaTeX is an order of magnitude better than using a Word Processor - especially when the files are backed by a git repo (which Overleaf provides) so tracking changes is easy (looking back at the history of changes in a file to see what I changed, is a big win).

Can't comment on how No Starch's editorial staff found working in Overleaf (because we haven't really discussed it), but for me it was all positive...


29 Jul, 2022

I've been using feedly since Google decided RSS wasn't a thing any more, and have been pretty happy with it. It wasn't as good as Google Reader, but good enough. The ads are gradually becoming more invasive though, and there's less of the minimalist feel it had when I first started using it, so I've been periodically looking for an alternative.

After finding nothing I was particularly enthused by, in the end I've decided on the slightly clunkier (certainly geekier) option: taking Tim Brownawell's Python-based RSS -> IMAP bridge, and modifying it to suit my needs.

RSS-IMAP reads feed config entries from an email in an IMAP folder, and then loads the feed items as email messages (if they aren't already present in the feed-specific subfolder) - my version reads config from a yaml file instead, and uses a SQLite database to store an index of feed items that have been loaded. Using the yaml file, because I find it easier to ssh onto my raspberry pi (where this is running) and edit the feed items there; than writing a mail, sending it to myself and then copying into the RSS folder. And using a SQLite DB, because that way I can delete feed emails and they won't be re-loaded automatically. SQLite is ideal for this sort of usage, because there's only a single process writing the data, and the index lookup is fast.

The main changes can be seen here:

Or found in the "alt" branch of my fork:

Posting in the unlikely event someone else finds these mods useful...

Long live RSS!!

Announcing: Python for Kids 2nd Edition

29 Apr, 2022

The 2nd edition of Python for Kids is coming October 2022. What's new? Not an exhaustive list, but it has been completely refreshed for the latest version of Python, as well as being updated for the latest versions of Windows and Ubuntu. New Raspberry Pi instructions are there for those who want to use a Pi to start their coding efforts. There are new programming puzzles, updated examples, and a pretty major tidy up of the text in general.

It's spring cleaning, refurbishment and good old spit polish in book form!

If you, or someone you know, are looking to get started with programming, it's currently available from No Starch Press (https://nostarch.com/python-kids-2nd-edition) on preorder, for 25% off (make sure you use coupon code PREORDER when checking out).

BBC micro:bit with Python for Kids

18 Apr, 2022

Janick writes:

My son got "Python for Kids" (the dutch translation) from Sinterklaas last december (Sinterklaas is the local Santa in Belgium and the Netherlands). He really enjoyed it! The weeks following he read and coded almost every day until he finished the book. Some days after, I mentioned we could investigate if he could use the micro:bit he got the year before to control his games. He was really into this idea and we looked for python packages that could make this possible. We didn't find any, and because the bluetooth APIs are a bit difficult to get started with for a kid, I created one myself: https://github.com/janickr/kaspersmicrobit. We both find the result really fun and engaging! It makes the games even more impressive and attractive for other kids (like his older sisters). I hope you like it too!

Glad your son enjoyed the book, and the micro:bit controller looks very cool -- I particularly like the 2-player adaptation of the Bounce game you came up with in the video:


Em Học Python

16 Nov, 2021

cover The Vietnamese translation of Python for Kids is now available from the publisher Sputnik Edu. I think that's something in the region of 12 languages in total now (including English)! 👍


19 Mar, 2021

I've built a Docker image for running single-node Spark and Hadoop (one worker) on a Raspberry Pi, since I couldn't find anything to experiment with. Certainly not suitable for anything other than experimentation, but the image can be found on Docker hub here:


The "source", such that it is (dockerfile, etc), can be access from radicle via this URN:


Booting Raspberry Pi from External USB

05 Feb, 2021

I wanted to boot my Raspberry Pi 4 from an external SSD connected via a USB-to-SATA cable. According to Jeff Geerling's video, it's pretty straightforward using the latest version of the firmware - but try as I might I couldn't get it to start. Tried re-imaging the SSD; also used the SD card copier, to copy the SD contents across to the SSD; but regardless it didn't seem to detect on boot (it was accessible after starting up using the SD, so I knew it probably wasn't a powering issue).

After much muddling around, came across rpi-eeprom-config, and realised that BOOT_ORDER was was set to 0x1 -- according to this page that's SD card mode. Also according to that page, the default is supposed to be 0xf41 (try SD, if not found, try USB). Ran sudo rpi-eeprom-config --edit, changed the value, saved, rebooted and voila, the SSD was bootable, and has been seemlessly working since then.

I'm sure this info has been posted elsewhere, but given I couldn't find it, posting here in case it's of use to someone else.

Breaking out of loops

30 Jan, 2021

Sherry W writes (excerpted):

Excellent book so far for my grandson.

On page 78 should it read?:

while True:
    lots of code here
    lots of code here
    lots of code here
    if some value == False

Book is written very well for that age group. It’s great to have a book that is able to explain concepts with simple examples.

The example on page 78 is not supposed to be executable code (obviously the text "lots of code here" repeated 3 times isn't), so it doesn't actually matter if the condition is "some_value == False" or "some_value == True". If I was going to write a runnable version of the example, it might look something like this:

some_value = True
while True:
    if some_value == True:

Which, if it was run, would print the following just once:


But you could use True or False in the above example (on the first line and the second-to-last line), and it would work just as well.

However a shortcut, not mentioned in the book (because I think simplicity and clarity is better for beginners), is that when you're checking for True, you can omit the "== True" altogether:

some_value = True
while True:
    if some_value:

Tkinter colorchooser problems (revisited)

23 Jul, 2020

Suranga writes:

My son and I have been learning Python with your great book. Unfortunately, we hit an issue with Colorchooser - the problem appears identical to this one: https://jasonrbriggs.com/journal/2013/05/01/tkinter-colorchooser-problems.html In the solution, you suggest we revisit Chapter 1 but can see no mention of a way to ensure IDLE is launched with No Subprocesses. Have we missed something here? Perhaps there was an earlier version of the book that did not contain this? (ours is the Tenth Printing). Thanks for any guidance you can provide!

No, you haven't missed anything. In subsequent printings of the book, my advice about using "No subprocess" has been removed -- that mode is no longer valid with the versions of Python 3 released since Python for Kids came out in 2012.

Interestingly, despite the fact all the code in the original print was tested by multiple people (including me!), I can't now find a version of python where from tkinter import * actually results in colorchooser.askcolor() working properly. So in yet later printings (some time after Jan 2017), I changed the instructions to reflect that fact that colorchooser is not imported by default when using import *.

This is now the corrected code:

from tkinter import *
from tkinter import colorchooser
tk = Tk()