[GRASS-dev] RE: [GRASS-user] Question with Python-SWIG example [SEC=UNCLASSIFIED]

Martin Landa landa.martin at gmail.com
Sun May 23 13:55:28 EDT 2010


Hi,

2010/5/21 Glynn Clements <glynn at gclements.plus.com>:

[...]

>> Yes, it's seems to be a ctypes issue.
>
> Well, the "manual" ctypes version worked earlier, so it appears to be
> a problem with the wrappers. The preamble's String type looks
> unnecessarily complex; there's probably a reason, but I have doubts as
> to whether the benefits outweight the drawbacks.
>
> Can you try r42331? This eliminates most of the preamble, making
> String and ReturnString aliases for c_char_p. If there's a need for
> something more complex, I'll deal with that if and when it happens.

Sample script:

#!/usr/bin/env python
import os, sys
from grass.lib import grass
from ctypes import *

grass.G_gisinit(sys.argv[0])

mapset = grass.G_find_raster2("elevation", "")
print mapset

Result:

Traceback (most recent call last):
  File "/home/martin/smetiste/example7.py", line 8, in <module>
    mapset = grass.G_find_raster2("elevation", "")
TypeError: __init__ expected at most 1 arguments, got 3

Martin

-- 
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa


More information about the grass-dev mailing list