Error during GeoDjango tutorial documentaion

35 views
Skip to first unread message

Benjamin Smith

unread,
Aug 26, 2018, 6:16:48 AM8/26/18
to django...@googlegroups.com
I am going through the GeoDjango tutorial from the official documentation.
  1. I have installed the required geospatial libraries, installed and enabled spatial functionality by extending the PostgreSQL via postgis.
  2. Downloaded the world borders data, and have unzipped the data.
  3. Created a GeoDjango model (WorldBorder) in the world app.
  4. Created the load.py inside the world app, as instructed in the documentation.
But when I try to import the load module and call the run routine, I am getting an error:

  Failed to save the feature (id: 141) into the model with the keyword arguments:
  Traceback (most recent call last):
    File "/home/vagrant/.virtualenvs/testenv/lib/python3.6/site-packages/django/contrib/gis/utils/layermapping.py", line 577, in _save
      stream.write('%s: %s\n' % ('Updated' if is_update else 'Saved', m))
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
  During handling of the above exception, another exception occurred:
  Traceback (most recent call last):
    File "<console>", line 1, in <module>
    File "/vagrant/geo_project/world/load.py", line 30, in run
      lm.save(strict=True, verbose=verbose)
    File "/home/vagrant/.virtualenvs/testenv/lib/python3.6/site-packages/django/contrib/gis/utils/layermapping.py", line 627, in save
      _save()
    File "/usr/lib/python3.6/contextlib.py", line 52, in inner
      return func(*args, **kwds)
    File "/home/vagrant/.virtualenvs/testenv/lib/python3.6/site-packages/django/contrib/gis/utils/layermapping.py", line 586, in _save
      stream.write('%s\n' % kwargs)
  UnicodeEncodeError: 'ascii' codec can't encode character '\xc3' in position 62: ordinal not in range(128)
 
I cannot figure out where I am wrong. Could you please help me out? Thank you.

Benjamin Smith

unread,
Aug 26, 2018, 6:57:01 AM8/26/18
to django...@googlegroups.com
I am using these version:

gdal-bin v2.2.3+dfsg-2

Python v3.6.5
Django v2.1
psycopg2 v2.7.5
postgis v2.4.3+dfsg-4

Jason

unread,
Aug 26, 2018, 8:18:21 AM8/26/18
to Django users

Benjamin Smith

unread,
Aug 28, 2018, 9:48:11 AM8/28/18
to django...@googlegroups.com
Thank you Jason, that was it.

On Sun, Aug 26, 2018 at 5:49 PM Jason <jjohn...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/94e6dc8f-ddb3-464a-be35-3bcc526cf5cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages