[GRASS-user] problems compiling grass 7

G. Allegri giohappy at gmail.com
Thu Jun 18 18:10:56 EDT 2009


It fails because "/etc/python/grass" isn't referenced as a package
without the __init__.py.

2009/6/18 Martin Landa <landa.martin at gmail.com>:
> Hi,
>
> 2009/6/18 Glynn Clements <glynn at gclements.plus.com>:
>>> >> etc/python/grass/__init__.py shouldn't contain "import lib" - it's
>>> >> bug.
>>> >
>>> > Commenting "import lib" soved it.
>>>
>>> OK, anyway it's wrong that this line was written to __init__.py when
>>> compilation of Python Swig failed.
>>
>> IMHO, this line shouldn't be written in either case. Code wishing to
>> use the SWIG bindings should explicitly use "import grass.lib". Or,
>> preferably, import "grass.lib.grass" etc. Loading a dozen libraries
>> "just in case" is a waste of resources and a potential source of
>> errors.
>>
>> Actually, I see no reason for grass/__init__.py to exist. Code can
>> just import grass.script or grass.lib or both as required.
>
> probably I misunderstand, but if I remove __init__.py, import fails, e.g.
>
>>>> import grass.script as grass
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named grass.script
>
> Martin
>
> --
> Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa
>


More information about the grass-user mailing list