Cannot fetch using d3.text while following Intro to TF-IDF tutorial

Howdy y’all!

Digging into Observable for the first time. Spent the morning trying to reproduce the Introduction to text analysis with TF-IDF tutorial by @kerryrodden. I’m trying to use this to analyze a collection of Church documents over time and consistently getting hung trying to fetch the text of each document.

I initially named the folder “documents”, but since “document” is reserved I switched it to “writings”. No matter what I try I’m getting these errors.

Does anyone know what I’m doing wrong?

1 Like

This is the repo I’m working with.

And this is the fork I just created hoping to fix the issue to no avail.

Hi @jameshahn2! Here’s a quick way for you to see what’s happening:

Promise.all( f => [f, await d3.text(f).catch(error => error)]))

Or, to just show the broken URLs:

  const errors = [];
  for (const f of files) {
    try {
      await d3.text(f);
    } catch (error) {
      yield errors;

For me this yields two broken links:

The first appears intended to refer to

But the second referenced file doesn’t appear to exist in the repository.

If you want to ignore any failing files, you can do this:

writings = Promise
  .all( => d3.text(d).catch(() => null)))
  .then(texts => texts.filter(t => t !== null))

Here is a suggestion you can merge with this change:


Awesome! I’ll get to the bottom of this.

Thank you, sir!!