Better Error Message for Custom Recipe

Hi gang. Getting started with a new tool is always hard and writing proper tutorial material is even harder. Still, I think there is a wrong error message in the code.

I got stuck for 10 minutes doing a 101 tutorial and I fear that this may have been due to a broken error message. I have a custom recipe in a file called “recipies.py”.

(venv) ec2-user:~/environment/prodigy (master) $ 
prodigy classify-numbers numbers "happy" -F recipe.py

    ERROR: Can't import recipe 'classify-numbers'.
  /home/ec2-user/environment/prodigy/recipe.py

The error suggests that it cannot import the recipe while the true error is that the file does not exist. A better error message would have saved me 10 minutes of confusion.

Thanks, that’s a really good point – and sorry for the frustration this caused! (I can definitely relate. I always try to keep a mental list of little frustrations and annoyances I come across when using other libraries and try to do it better in the software I write. So feedback like this is always super valuable.)

I’ve now added one more condition that checks whether the path points to a file or symlink and if not, raises the following error:

  ✨  ERROR: Invalid recipe file path
  /home/ec2-user/environment/prodigy/recipe.py

I thought checking for is_file() instead of just exists() might be nice here, because it’ll also show the error if you accidentally point it to a directory, which can easily happen with tab-complete.

1 Like

muchas gracias.

ill conclude with a minor plug, id love for my local community to learn more about spacy and that ecosystem: https://pydata.org/amsterdam2018/cfp/

Thanks! Unfortunately, the dates won't work for us :sweat: Matt and I are already speaking at the Data Science Summit in Tel Aviv on the 28th, so we won't be around.

But we'd be happy to spread the word on Twitter – maybe someone from our community wants to submit a talk or workshop proposal. If you post something and tag @spacy_io, we can retweet it!

1 Like

and done. this turned out to be a very fruitful bug report.

1 Like

Fixed in the latest v1.4.1! :tada: