-
Notifications
You must be signed in to change notification settings - Fork 126
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
Region matching query does not exist. #215
Comments
Until somebody proposes a fix you can use 3.5.1 which is the same without
sub-regions.
|
@jitp WIll be good if you share a stack trace of the error that you received and more information about your stack, like os, python version and the version of Django. |
@jpic on development is fixed this issue and probably another issue. |
Thank you @Bomba1990. I did the same as you did on my local copy of the source code so I could keep going on using it. After that issue another one came up and it's related to some subregions with the same geoname_code. I solved it like this:
It is a bit out of design but it solved the issue. I think. I'm using python 3.6.9 with django 1.11 on ubuntu 18.04 |
Yes, I found the same issue @jitp. But I see that the issue was on the _get_subregion_id method, the code for the filter by region is doing by country, I change this to filter by region and work perfectly. |
@Bomba1990 excellent! I just see your commit with the change in _get_subregion_id. |
It looks like this issue was never closed and I'm experiencing the same error.
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.6/site-packages/cities_light/management/commands/cities_light.py", line 205, in handle
self.city_import(items)
File "/usr/local/lib/python3.6/site-packages/cities_light/management/commands/cities_light.py", line 504, in city_import
items[ICity.admin2Code]
File "/usr/local/lib/python3.6/site-packages/cities_light/management/commands/cities_light.py", line 282, in _get_subregion_id
country_id=country_id, geoname_code=region_id).pk
File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 408, in get
self.model._meta.object_name
cities_light.models.DoesNotExist: Region matching query does not exist.
|
I am getting the same error any solution? |
@im-khalidbutt Please open a new ticket with the error that you have, the versions of Django, and if you can provide more information on your existing database. |
I installed the package but when I run cities_light command I get that error when script is importing the cities.
Maybe the issue happens when trying to insert a subregion from a non existing region.
On that function on the first if, a query to Region is made and it raises an exception as it doesn't find it but in the outer function calling the above one there is a try except clause but only catches exceptions from non existing Subregions (second if in the above function).
So the Region exception goes freely and breaks everything.
The text was updated successfully, but these errors were encountered: