Martin Landa wrote: > > it shouldn't be possible for this: > > > > G_find_raster2.argtypes = [c_char_p, c_char_p] > > G_find_raster2.restype = c_char_p > > > > to work but this: > > > > G_find_raster2.argtypes = [String, String] > > G_find_raster2.restype = ReturnString > > Here I am getting > > Traceback (most recent call last): > File "/home/martin/smetiste/example7.py", line 8, in <module> > grass.G_find_raster2.argtypes = [String, String] > NameError: name 'String' is not defined > > even ctypes are imported (from ctypes import *).
String and ReturnString are defined in ctypes_preamble.py and imported into the individual wrapper modules (e.g. grass.py). They should be visible within the script as grass.String, etc. G_find_raster2 is (or should be) defined in grass.py as: # /usr/local/src/grass/7.0/dist.i686-pc-linux-gnu/include/grass/gisdefs.h: 220 if hasattr(_libs['grass_gis'], 'G_find_raster2'): G_find_raster2 = _libs['grass_gis'].G_find_raster2 G_find_raster2.restype = ReturnString G_find_raster2.argtypes = [String, String] The only imports in grass.py are: from ctypes_preamble import * from ctypes_preamble import _variadic_function from ctypes_loader import * so it shouldn't be possible for it to pick up some other definition for "String". It's annoying that the error message doesn't indicate which class's __init__ method is involved, or the traceback. Some other things to check: > from grass.lib import grass > grass.String <class 'ctypes.c_char_p'> > grass.ReturnString <class 'ctypes.c_char_p'> > grass.G_find_raster2 <_FuncPtr object at 0x827eecc> > grass.G_find_raster2.__class__ <class 'ctypes._FuncPtr'> > grass.G_find_raster2.argtypes [<class 'ctypes.c_char_p'>, <class 'ctypes.c_char_p'>] > grass.G_find_raster2.restype <class 'ctypes.c_char_p'> > grass.G_find_raster2._restype_ <class 'ctypes.c_long'> > grass.G_find_raster2._objects {'0': <CDLL '/usr/local/src/grass/svn/dist.i686-pc-linux-gnu/lib/libgrass_gis.so', handle 8193e88 at 824f32c>} -- Glynn Clements <gl...@gclements.plus.com> _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev