ctypes / cygwin / django+geos

kiorky kiorky at cryptelium.net
Thu Dec 10 10:37:52 EST 2009


I am encountering errors with ctypes and geos.
The same configuration (geos-3.0 or geos-3.2) runs fine under classical unixes
like freebsd, mac or linux but do not pass with cygwin with 'free' function not
found.




My configuration is 2.6.4 Release, and a little patch for ctypes which lets all
its test pass (loading cygpythonxx.dll instead of libpython.dll):
Testing package ctypes.test ('2.6.4 (r264:75706, Dec  6 2009, 16:44:34) \n[GCC
4.3.4 20090804 (release) 1]', 'cygwin', 'posix')
......................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 326 tests in 1.671s (0 modules skipped)
Unavailable resources: printing, refcount




Then, using it by hand with an helloword library makes no problem.




However, using it in my real world UseCase [1], make me think that there is a
problem with ctypes.
Indeed, geos is compiled and its huge test coverage pass.
But then, trying to use ctypes over geos do not work.
$ 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 (*�)
-- 
Cordialement,
KiOrKY
GPG Key FingerPrint: 0x1A1194B7681112AF



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20091210/b7ad019d/attachment.sig>


More information about the Python-list mailing list