coderholic / django-cities

Countries and cities of the world for Django projects
MIT License
921 stars 375 forks source link

Django 1.10 django.core.exceptions.ValidationError: [u"'' value must be either True or False."] #130

Closed dpmontero closed 7 years ago

dpmontero commented 7 years ago

I have a new issue, not import data on the tables, I think the reason is: File "/env/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1018, in to_python params={'value': value}, django.core.exceptions.ValidationError: [u"'' value must be either True or False."]

The traceback:


> python manage.py cities --import=all
> Importing countries...:  99%|██████████████████▊| 250/252 [00:00<00:00, 397.79it/s]
> Building country index: 100%|█████████████████| 250/250 [00:00<00:00, 20376.53it/s]
> Importing regions: 100%|██████████████████████| 3893/3893 [00:08<00:00, 448.14it/s]
> Building region index: 100%|██████████████████| 3893/3893 [00:06<00:00, 559.10it/s]
> Importing subregions:   5%|▉                 | 2111/41003 [00:04<01:26, 450.93it/s]No handlers could be found for logger "cities"
> Importing subregions: 100%|█████████████████| 41003/41003 [01:38<00:00, 414.62it/s]
> Building region index: 100%|████████████████| 44887/44887 [02:28<00:00, 303.19it/s]
> Importing cities: 100%|█████████████████████| 79515/79515 [01:40<00:00, 789.66it/s]
> Building hierarchy index: 100%|████████| 370294/370294 [00:02<00:00, 136618.92it/s]
> Importing districts: 100%|█████████████████| 79515/79515 [00:15<00:00, 5286.17it/s]
> Building geo index for countries: 100%|███████| 250/250 [00:00<00:00, 23852.41it/s]
> Building geo index for regions: 100%|███████| 3893/3893 [00:00<00:00, 41512.45it/s]
> Building geo index for subregions: 100%|██| 40994/40994 [00:01<00:00, 28546.20it/s]
> Building geo index for cities: 100%|███████| 28479/28479 [00:05<00:00, 5320.34it/s]
> Building geo index for districts: 100%|██████| 1044/1044 [00:00<00:00, 6766.26it/s]
> Importing data for alternative names:   0%| | 1/11313250 [00:05<17607:38:22,  5.60s/it]
> Traceback (most recent call last):
>   File "manage.py", line 22, in <module>
>     execute_from_command_line(sys.argv)
>   File "/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
>     utility.execute()
>   File "/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv
>     self.execute(*args, **cmd_options)
>   File "/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
>     output = self.handle(*args, **options)
>   File "/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
>     return func(*args, **kwargs)
>   File "/env/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 112, in handle
>     func()
>   File "/env/local/lib/python2.7/site-packages/cities/management/commands/cities.py", line 600, in import_alt_name
>     alt.save()
>   File "/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 796, in save
>     force_update=force_update, update_fields=update_fields)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 824, in save_base
>     updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 889, in _save_table
>     forced_update)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 939, in _do_update
>     return filtered._update(values) > 0
>   File "/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 652, in _update
>     return query.get_compiler(self.db).execute_sql(CURSOR)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1148, in execute_sql
>     cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 824, in execute_sql
>     sql, params = self.as_sql()
>   File "/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1112, in as_sql
>     val = field.get_db_prep_save(val, connection=self.connection)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 755, in get_db_prep_save
>     prepared=False)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 747, in get_db_prep_value
>     value = self.get_prep_value(value)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1025, in get_prep_value
>     return self.to_python(value)
>   File "/env/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1018, in to_python
>     params={'value': value},
> django.core.exceptions.ValidationError: [u"'' value must be either True or False."]

Thanks!

dpmontero commented 7 years ago

I solved!!

Reinstall all and upgrade python to 3.5

blag commented 7 years ago

Should be fixed by #133. Closing.