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

Successors pointing to null #1

Open
yohanboniface opened this issue May 15, 2018 · 1 comment
Open

Successors pointing to null #1

yohanboniface opened this issue May 15, 2018 · 1 comment

Comments

@yohanboniface
Copy link
Member

Traceback (most recent call last):
  File "/home/ybon/.virtualenvs/geozone/bin/addok", line 11, in <module>
    sys.exit(main())
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/bin/__init__.py", line 30, in main
    args.func(args)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/shell.py", line 478, in invoke
    cmd.loop()
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/shell.py", line 74, in loop
    self.cmdloop()
  File "/usr/lib64/python3.6/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib64/python3.6/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/shell.py", line 66, in default
    return self.do_SEARCH(line)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/shell.py", line 196, in do_SEARCH
    self._search(query)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/shell.py", line 166, in _search
    results = helper(query, lat=lat, lon=lon, **filters)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/core.py", line 169, in __call__
    return self.render()
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/core.py", line 183, in render
    self.convert()
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/core.py", line 230, in convert
    processor(self, result)
  File "/home/ybon/Code/py/addok-geozones/addok_geozones/utils.py", line 32, in follow_successor
    successor = Result.from_id(id)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/core.py", line 107, in from_id
    return Result(dbkeys.document_key(_id))
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/core.py", line 35, in __init__
    self.load(_id)
  File "/home/ybon/.virtualenvs/geozone/lib/python3.6/site-packages/addok/core.py", line 45, in load
    raise ValueError('id "{}" not found'.format(doc_or_id[2:]))
ValueError: id "fr:commune:27049@2016-01-01" not found

When searching for "épinay" with latest dataset.
Having a quick look at it, it seems that the bug appears because some city have a successor which has a successor itself, so the first target does not exist in the dataset.
I'll work around for now, to prevent a crash.

cc @davidbgk

@yohanboniface
Copy link
Member Author

Added a log:
Unable to find successor fr:commune:27049@2016-01-01 from id fr:commune:27221@1942-01-01
Unable to find successor fr:commune:61324@2016-01-01 from id fr:commune:61155@1942-01-01

yohanboniface added a commit that referenced this issue May 15, 2018
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