Unable to use directory path as source in latest version

I have a custom loader that is able to load from a directory containing multiple files, or at least used to be able to... when I supply a directory path as source to textcat.manual I now get a weird error:

prodigy textcat.manual test-textcat ./data/raw --loader my.custom.loader --label LABEL1,LABEL2
✘ The textcat.manual arguments have changed in v1.9
It looks like you're passing in a spaCy model as the second argument, which is
not needed anymore (and wasn't used before). Try removing the argument and run
textcat.manual again. You can also run this command with --help or see the docs
for details.

Thanks for the report and sorry about that – looks like this is a flaw in the logic to handle backwards compatibility of the arguments. This happens when you try to be too clever :sweat_smile::woman_facepalming:

Essentially, it tries to figure out whether the first agument is a spaCy model (previously the second argument, which ended up being unused), without actually trying to load it. To do that, the recipe checks for not Path(source).exists() or not Path(source).is_file(), which is bad and results in the error you see.

Instead, it should probably just try to call spacy.load on the first argument and show the error if that succeeds (first argument is spaCy model). Even if that takes a few seconds, it's still better than the hack we currently have. I'll fix this for the next release! :+1:

In the meantime, you can just edit the recipe in textcat.py and remove that condition at the top. If you're calling the recipe with the new arguments, you won't need this additional check anyways.

OK, thanks for letting me know and addressing that!