You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you add a Python corpus definition through your settings, the name you assign in the settings is not arbitrary. It's used to select the corpus class, so if you choose an unexpected name, the import module won't be able to find the Python corpus.
If a corpus was included in your settings but can't be loaded, the console will show an error message. This always starts with Could not load corpus {corpus-name}:, followed by whatever error was raised during the import process. This can happen for all sorts of reasons, including mistakes in the corpus definition.
I've seen these two messages pop up in that scenario, which were fixed when I corrected the name of the corpus:
getattr(): attribute name must be string
expected str, bytes or os.PathLike object, not NoneType
These errors are caused somewhere in this block of code:
# assume the class name is the same as the corpus name,
# allowing for differences in camel case vs. lower case
regex=re.compile('[^a-zA-Z]')
corpus_name=regex.sub('', corpus_name).lower()
endpoint=next((attrforattrindir(corpus_mod)
ifattr.lower() ==corpus_name), None)
corpus_class=getattr(corpus_mod, endpoint)
returncorpus_class()
Tracing the error is left as an exercise to the reader. In any case, the issue here is that these messages aren't helpful in identifying the problem (that you picked an incorrect name).
Solution: wrap these lines in a try-except block. You should get a message like "cannot find an object matching name 'my-corpus' in python module blablabla/my-corpus.py", or something like that.
The text was updated successfully, but these errors were encountered:
If you add a Python corpus definition through your settings, the name you assign in the settings is not arbitrary. It's used to select the corpus class, so if you choose an unexpected name, the import module won't be able to find the Python corpus.
If a corpus was included in your settings but can't be loaded, the console will show an error message. This always starts with
Could not load corpus {corpus-name}:
, followed by whatever error was raised during the import process. This can happen for all sorts of reasons, including mistakes in the corpus definition.I've seen these two messages pop up in that scenario, which were fixed when I corrected the name of the corpus:
getattr(): attribute name must be string
expected str, bytes or os.PathLike object, not NoneType
These errors are caused somewhere in this block of code:
I-analyzer/backend/addcorpus/python_corpora/load_corpus.py
Lines 40 to 48 in 7e92eef
Tracing the error is left as an exercise to the reader. In any case, the issue here is that these messages aren't helpful in identifying the problem (that you picked an incorrect name).
Solution: wrap these lines in a try-except block. You should get a message like "cannot find an object matching name 'my-corpus' in python module blablabla/my-corpus.py", or something like that.
The text was updated successfully, but these errors were encountered: