Coder Social home page Coder Social logo

OSError exception about django-geojson HOT 2 OPEN

andywar65 avatar andywar65 commented on August 31, 2024
OSError exception

from django-geojson.

Comments (2)

Gagaro avatar Gagaro commented on August 31, 2024

I'm not sure I understand, why did you have the OSError in the first place?

from django-geojson.

andywar65 avatar andywar65 commented on August 31, 2024

I'm on Windows 10 Pro, build 19045.4474 (not WSL)
Let's say I create a virtual environment and activate it, and pip install django and django-geojson.
Then I start a django project and add 'djgeocad' to INSTALLED_APPS.
I migrate and run the server, that crashes. This is the error I get:

Exception in thread django-main-thread:
Traceback (most recent call last):
[...]
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\djgeojson\templatetags\geojson_tags.py", line 8, in <module>
    from django.contrib.gis.db.models.fields import GeometryField
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\db\models\__init__.py", line 3, in <module>
    import django.contrib.gis.db.models.functions  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\db\models\functions.py", line 3, in <module>
    from django.contrib.gis.db.models.fields import BaseSpatialField, GeometryField
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\db\models\fields.py", line 3, in <module>
    from django.contrib.gis import forms, gdal
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\forms\__init__.py", line 3, in <module>
    from .fields import (  # NOQA
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\forms\fields.py", line 2, in <module>
    from django.contrib.gis.gdal import GDALException
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\gdal\__init__.py", line 29, in <module>
    from django.contrib.gis.gdal.datasource import DataSource
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\gdal\datasource.py", line 41, in <module>
    from django.contrib.gis.gdal.driver import Driver
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\gdal\driver.py", line 5, in <module>
    from django.contrib.gis.gdal.prototypes import ds as vcapi
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 10, in <module>
    from django.contrib.gis.gdal.libgdal import lgdal
  File "D:\venvs\test-djgeojson\env\Lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 69, in <module>
    lgdal = CDLL(lib_path)
            ^^^^^^^^^^^^^^
  File "C:\Users\Andrea\AppData\Local\Programs\Python\Python312\Lib\ctypes\__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 127] The specified procedure could not be found

It is probably a configuration error.
If you go to djgeojson/templatetags/geojson_tags.py from line 7 to 12 you find this:

try:
    from django.contrib.gis.db.models.fields import GeometryField
    from django.contrib.gis.geos import GEOSGeometry
except (ImportError, ImproperlyConfigured):
    from ..nogeos import GEOSGeometry
    from ..fields import GeometryField

If you add the OSError to the exceptions (same for the other two files in the opening message of the issue), everything works fine.
Thank you for your help

from django-geojson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.