#27960: ds = DataSource('/path/to/your/cities.shp') fails on first try
(GDALException Unknown error code: "198770787"), but works on second
-----------------------------------+--------------------------------------
     Reporter:  Etiënne Thomassen  |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  GIS                |                  Version:  1.10
     Severity:  Normal             |               Resolution:
     Keywords:  DataSource, GIS    |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Description changed by Etiënne Thomassen:

Old description:

> I can not create a DataSource from a gpx file. It returns GDALException
> Unknown error code: "198770787" with the error code number seemingly
> random. However on the second try it works. And it does not even need to
> be the same file.
>

> {{{
> Python 3.6.0 (default, Dec 24 2016, 08:01:42)
> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from django.contrib.gis.gdal import DataSource
> >>> ds = DataSource('Bleswerk dec16.gpx')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
> packages/django/contrib/gis/gdal/datasource.py", line 64, in __init__
>     Driver.ensure_registered()
>   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
> packages/django/contrib/gis/gdal/driver.py", line 83, in
> ensure_registered
>     rcapi.register_all()
>   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
> packages/django/contrib/gis/gdal/prototypes/errcheck.py", line 119, in
> check_errcode
>     check_err(result, cpl=cpl)
>   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
> packages/django/contrib/gis/gdal/error.py", line 74, in check_err
>     raise GDALException('Unknown error code: "%s"' % code)
> django.contrib.gis.gdal.error.GDALException: Unknown error code:
> "-1935278031"
> >>> ds = DataSource('20140525_170950_gpx.gpx')
> >>> ds.layer_count
> 5
> }}}
>
> This post on StackOverflow pointed me in this direction:
> http://stackoverflow.com/questions/41775536/datasource-gdalexception-
> unknown-error-code-474873798
>
> Strangely, I can now get it to work doing this in my app:
>
> {{{
> try:
>     datasource = DataSource(target_path)
> except:
>     datasource = DataSource(target_path)
> }}}

New description:

 I can not create a DataSource from a gpx file. It returns GDALException
 Unknown error code: "198770787" with the error code number seemingly
 random. However on the second try it works. And it does not even need to
 be the same file.


 {{{
 Python 3.6.0 (default, Dec 24 2016, 08:01:42)
 [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> from django.contrib.gis.gdal import DataSource
 >>> ds = DataSource('Bleswerk dec16.gpx')
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
 packages/django/contrib/gis/gdal/datasource.py", line 64, in __init__
     Driver.ensure_registered()
   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
 packages/django/contrib/gis/gdal/driver.py", line 83, in ensure_registered
     rcapi.register_all()
   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
 packages/django/contrib/gis/gdal/prototypes/errcheck.py", line 119, in
 check_errcode
     check_err(result, cpl=cpl)
   File "/Users/etienne/.virtualenvs/bosbot3/lib/python3.6/site-
 packages/django/contrib/gis/gdal/error.py", line 74, in check_err
     raise GDALException('Unknown error code: "%s"' % code)
 django.contrib.gis.gdal.error.GDALException: Unknown error code:
 "-1935278031"
 >>> ds = DataSource('20140525_170950_gpx.gpx')
 >>> ds.layer_count
 5
 }}}

 This post on StackOverflow pointed me in this direction:
 http://stackoverflow.com/questions/41775536/datasource-gdalexception-
 unknown-error-code-474873798

 Strangely, I can now get it to work doing this in my app:

 {{{
 try:
     datasource = DataSource(target_path)
 except:
     datasource = DataSource(target_path)
 }}}

 Btw this part of my app stopped working migrating from Django 1.8 and
 Python 2.7 to Django 1.9 and Python 3.6. Now on Django 1.10 and Python 3.6

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27960#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/074.59cc6859fd51578fed42add9b08c76be%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to