Cleaning up Zotero’s “The attached file could not be found at the following path”

After an upgrade to one of the machines linked to my Zotero account, I got errors that some of the attached filed could not be found. Now, I attach most of my files, so I was pretty sure that the files were there. I also double-checked that the base directory was set correctly, and that it was set to relative paths (moreover, only some of the attached PDF were affected, so I knew that the basic setup was OK).

Using Zutilo (a plugin for Zotero), I could figure out that the problem of those attached files was that an absolute path was set. In fact, on the Windows machine (i.e. the machine that was upgraded and where Zotero was set up afresh), I could simply choose to select the file again to resolve the issue, but there were more than a handful of attachments involved.

So I used the Zotero Storage Scanner (another plugin for Zotero). I was useful to read the instructions, as the scanner plugin has no GUI and works in the background to tag broken attachments. On my machine, I got around 1 entry tagged per second, so adjust your expectations accordingly.

Because the scanner plugin tags the attachments/PDF and not the articles, I then created a new collection in Zotero. Selecting the #broken_attachments tag, pressing minus (to collapse all items), I then added all the items to that collection. This way, I was sure to select the entries for the next step.

Selecting all articles with broken attachments, enter Zutilo for the second time. This time, I needed to “Modify attachment paths”. There are two boxes, one after the other. So in the first one, I entered that part of the absolute path, that wasn’t needed (I copied this from Zutilo’s “show attachment paths”), like “D:\ZoteroPDF\” (without quotes). In the second one, I added “attachments:” (without quotes, but including the colon). On my machine, this took around 3 seconds for 2k items.

Because I did the fixes on the GNU/Linux machine (this will also apply to Mac), I used Zutilo once again to modify attachment paths: In the first box, I entered the backslash (“\” without quotes), and made sure to tick “change all instances”, and then in the second box I entered the forward slash (“/” without quotes).

Getting everything synced on the Zotero servers took a while, but all my attachments work again as they should.

Fixing Jupyter access denied on Ubuntu 22.04

After the upgrade to Ubuntu 22.04 Jupyter Notebook (on Firefox 99.0.1) would greet me with an Access Denied error. Not exactly conducive to work.

I tried setting access right of the directories (I also thought about access issues given that .local is a hidden directory), but it turns out that creating an explicit configuration helps:

jupyter notebook --generate-config

This creates a file at: ~/.jupyter/

and in this (text) file we’re looking for c.NotebookApp.use_redirect_file, uncomment it, and set it to

c.NotebookApp.use_redirect_file = False

(as explained in the comments; this seems completely fine on a single-user machine).

Let Rhythmbox play MP3 again

Today I noticed Rhythmbox not playing some music files in Debian. After a bit of digging around, I noticed the warning “your gstreamer installation is missing a plugin” in the file properties. From there it wasn’t far to realize that MP3 files did not play in Rhythmbox (any more), and that I probably need a (new) plugin (it’s Debian ‘unstable’ after all, so this was probably introduced by a recent update). sudo apt install gstreamer1.0-fluendo-mp3 and restarting Rhythmbox was all I needed to do.

“I don’t care about cookies” breaks ORCID — easy fix

I have discovered that the Firefox add-on “I don’t care about cookies” breaks ORCID in the sense that the ‘visibility buttons’ on ORCID are not shown when editing the ORCID record. After experimenting a bit, I discovered that it was the said add-on that somehow breaks the page. There’s an easy fix: white-list by visiting the page, right-clicking “I don’t care about cookies” > “disable on”. Done.

A Modified Shapefile for Plotting Swiss Cantons

The GADM database of Global Administrative Areas is the place to go for shapefiles of administrative boundaries. The data are freely available for academic use and other non-commercial use. Unfortunately, the boundaries of the Swiss cantons are a bit buggy. Version 2 has fixed the presence of a 27th canton — part of Lake Geneva, but it includes the entire lake of any lake shared with a neighbouring country as Swiss territory.

The licence of the GADM files is never made explicit, and while it says “Please contribute in whatever way you can by sending us a message to point out errors, or even better, to send an improved file for a country of your interest,” there is no way to send improved files on their website. I never got replies to my messages, so consider this post as my sending an improved file.

The files are on Github. I have modified cantonal boundaries so that they match the national boundaries: only the Swiss part of lakes is included as Swiss territory. I’m not sure the files other than the .shp, .shx, .dbf, .prj are actually needed.

Here’s how to draw a map in R. First we load two libraries:


Then we import the shapefile:

x <- readOGR(dsn = ".", layer = "ch-cantons")

The dsn argument takes the location of the shapefile (dot for current directory); the layer argument takes the name of the shapefile without extensions.

And now we draw the map:

data <- 1:26 # values to plot
x$data <- data # add to SpatialPolygonsDataFrame
col <- rev(heat.colors(26)) # define colours
spplot(x, "data", col.regions=col, main="", colorkey=TRUE)

The cantons are as follows: c("AG","AR", "AI","BL", "BS", "BE", "FR", "GE", "GL", "GR", "JU", "LU", "NE", "NW", "OW", "SG", "SH", "SZ", "SO", "TG", "TI", "UR", "VS", "VD", "ZH", "ZG").