No Good Deed Unpunished – tempfile and Snap

I was finally fixing up my superhelp package when I noticed that the HTML output no longer displayed successfully in the web browser (whether on Firefox or Chromium).

The error message in the browser was:

File not found

Firefox can’t find the file at
/tmp/superhelp_project_output/_home_g_Documents_python_python_scripts_superhelp_demo.py.html.

At first I assumed it was because of breaking changes in a dependency or something like that – I have encountered a few as I finally try to bring my project up to date. But no – the real answer is that both Firefox and Chromium on my machine are installed as snap packages. And snap packages are isolated from system paths such as /tmp – they use their own version (see file:///tmp/ in Firefox does not show contents of /tmp).

So I can’t use the elegant Python tempfile-based solution (cross-platform, semantic, documented) and will need to manage creating the file myself. And I thought I was doing the right thing … sigh …