cygwin1.7 / ctypes / geos

8 views
Skip to first unread message

kiorky

unread,
Dec 23, 2009, 9:11:43 AM12/23/09
to geodjango
I asked a similar post on the python mailing list as i don't know
where people
can help me on that subjet.

I am stuck with the code of django-1.0.2

I have geos compiled and fully functionnal.

my next step is to validate the Django ctypes bindings, and there are
some
tests out there to do that.

Here come problems.

For ctypes:
With my python-2.6.4 hand made with some patches stolen from cygwin
port
(specially the ctypes one, and some arrangements (load cygpython26.Dll
instdead
of libpython26.dll for example), i can compile and use a c or a c++
helloworld
library without problems and unittest for ctypes do not fail.

However, using the geos tests, i got problems:
$ cat geos.py
from django.contrib.gis.tests import test_geos
test_geos.run()
$ /minitage/dependencies/python-2.6/parts/part/bin/python bin/djangopy
geos.py

Testing WKT output. ... ERROR
Testing HEX output. ... ERROR
Testing KML output. ... ERROR
Testing the Error handlers. ...
BEGIN - expecting GEOS_ERROR; safe to ignore.
GEOS_ERROR: ParseException: Expected number but encountered ','
GEOS_ERROR: ParseException: Unknown WKB type 255
END - expecting GEOS_ERROR; safe to ignore.
GEOS_ERROR: ParseException: Unexpected EOF parsing WKB
ok
Testing WKB output. ... ERROR
Testing creation from HEX. ... ERROR
Testing creation from WKB. ... ERROR
Testing EWKT. ... ERROR
Testing GeoJSON input/output (via GDAL). ... ok
Testing equivalence. ... ERROR
Testing Point objects. ... ERROR
Testing MultiPoint objects. ... ERROR
Testing LineString objects. ... ERROR
Testing MultiLineString objects. ... ERROR
Testing LinearRing objects. ... ERROR
Testing Polygon objects. ... ERROR
Testing MultiPolygon objects. ...
BEGIN - expecting GEOS_NOTICE; safe to ignore.

ERROR
Testing Geometry __del__() on rings and polygons. ... ERROR
Testing Coordinate Sequence objects. ... ok
Testing relate() and relate_pattern(). ... ERROR
Testing intersects() and intersection(). ... ok
Testing union(). ... ok
Testing difference(). ... ok
Testing sym_difference(). ... ok
Testing buffer(). ... ok
Testing the SRID property and keyword. ... ERROR
Testing the mutability of Polygons and Geometry Collections. ... ERROR
Testing three-dimensional geometries. ... ok
Testing the distance() function. ... ok
Testing the length property. ... ok
Testing empty geometries and collections. ... ERROR
Testing `ogr` and `srs` properties. ... ok
Testing use with the Python `copy` module. ... ok
Testing `transform` method. ... ok
Testing `extent` method. ... ok
Testing pickling and unpickling support. ... ERROR
======================================================================
ERROR: Testing WKT output.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/cygdrive/e/minitage2/eggs/cache/
Django-1.0.2_final_ZMinitagePatched_DjangoCchb-py2.6.egg/django/
contrib/gis/tests/test_geos.py",
line 28, in test01a_wkt
self.assertEqual(g.ewkt, geom.wkt)
File
"/cygdrive/e/minitage2/eggs/cache/
Django-1.0.2_final_ZMinitagePatched_DjangoCchb-py2.6.egg/django/
contrib/gis/geos/base.py",
line 378, in wkt
return to_wkt(self.ptr)
File
"/cygdrive/e/minitage2/eggs/cache/
Django-1.0.2_final_ZMinitagePatched_DjangoCchb-py2.6.egg/django/
contrib/gis/geos/prototypes/errcheck.py",
line 67, in check_string
libc.free(result)
File
"/minitage/dependencies/python-2.6/parts/part/lib/python2.6/ctypes/
__init__.py",
line 366, in __getattr__
func = self.__getitem__(name)

File
"/minitage/dependencies/python-2.6/parts/part/lib/python2.6/ctypes/
__init__.py",
line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'free' not found (*�)

Why free() is not found ?

kiorky

unread,
Dec 23, 2009, 4:39:50 PM12/23/09
to geodjango
We found a solution on IRC, basicly, it's to use an helper function
'GEOSFree', see [1] for extra informations

This fix is likely to be fixed upstream (django side).

[1] - http://code.djangoproject.com/ticket/12438

Reply all
Reply to author
Forward
0 new messages