Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config template inconsistent with code for VocabSource FILE #73

Open
nicholas512 opened this issue Feb 7, 2022 · 0 comments
Open

config template inconsistent with code for VocabSource FILE #73

nicholas512 opened this issue Feb 7, 2022 · 0 comments

Comments

@nicholas512
Copy link

When configuring VocPrez to run with the example files provided in data/vocab_files by adapting the default template (_config/template.py) I use the following configuration.

DATA_SOURCES = {
    # example SPARQL source configured using variables in "Instance Vars" above
    "defaults": {
        "source": VocabSource.FILE,
        "directory":"/home/user/src/VocPrez/vocprez/data"
    }

VocPrez throws an error when trying to load the dataset:

ERROR:vocprez.app:Exception on / [GET]
Traceback (most recent call last):
  File "/home/user/src/VocPrez/vocenv/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/user/src/VocPrez/vocenv/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/user/src/VocPrez/vocenv/lib/python3.8/site-packages/flask/app.py", line 1514, in full_dispatch_request
    rv = self.preprocess_request()
  File "/home/user/src/VocPrez/vocenv/lib/python3.8/site-packages/flask/app.py", line 1857, in preprocess_request
    rv = self.ensure_sync(before_func)()
  File "/home/user/src/VocPrez/vocprez/app.py", line 63, in before_request
    u.cache_reload()
  File "/home/user/src/VocPrez/vocprez/utils.py", line 93, in cache_reload
    cache_load()
  File "/home/user/src/VocPrez/vocprez/utils.py", line 83, in cache_load
    getattr(source, source_details["source"]).collect(source_details)
AttributeError: module 'vocprez.source' has no attribute 'FILE'

I was able to fix this by changing the capitalization in VocabSource to match the definition of the File class

class VocabSource:
    File= "File"
    SPARQL = "SPARQL"
    RVA = "RVA"
    VOCBENCH = "VOCBENCH"
    GITHUB = "GITHUB"

and

DATA_SOURCES = {
    # example SPARQL source configured using variables in "Instance Vars" above
    "defaults": {
        "source": VocabSource.File,
        "directory":"/home/user/src/VocPrez/vocprez/data"
    }

I suppose this could also be done by changing the File class to FILE .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant