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

Martin Landa landa.martin at gmail.com
Sun May 23 18:49:01 EDT 2010


Hi,

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

[...]

> Not only can I not reproduce this, I can't see any mechanism by which
> it can occur. Have you done "make clean"? What is the value of

yes (make distclean)

> grass.__file__ after importing it?

>>> from grass.lib import grass
>>> grass.__file__
'/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/etc/python/grass/lib/grass.pyc'

> Given that ctypes_preamble.py defines:
>
>        String = c_char_p
>        ReturnString = c_char_p

right,

> 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 *).

Martin

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


More information about the grass-dev mailing list