[GRASS-dev] error during auto-completion of MetaModule istance in the interactive python shell

Pietro peter.zamb at gmail.com
Tue May 27 00:31:29 PDT 2014


Dear dev,

Markus N. noticed that the auto-completion of the MetaModule instances
(pygrass.modules.shortcuts [0]) is broken...

if you open inside a grass terminal a ipython shell or if you try the
integrated shell in GRASS GUI the simple code:

{{{
from grass.pygrass.modules.shortcuts import vector as v
v.->TAB
}}}

You will get an OSError exception.

Here an example using ipythoninside the grass terminal.

In [1]: from grass.pygrass.modules.shortcuts import vector as v

In [2]: v.OSError error(2): No such file or directory
OSError error(2): No such file or directory

Display all 125 possibilities? (y or n)
v.buffer               v.db_connect           v.edit
v.in_mapgen            v.lrs_create           v.net_flow
v.out_pov              v.rectify              v.to_rast
v.build                v.db_dropcolumn        v.external
v.in_ogr               v.lrs_label            v.net_iso
v.out_svg              v.report               v.to_rast3
v.build_all            v.db_droprow           v.external_out
v.in_region            v.lrs_segment          v.net_path
v.out_vtk              v.sample               v.transform
v.build_polylines      v.db_droptable         v.extract
v.in_sites             v.lrs_where            v.net_salesman
v.outlier              v.segment              v.type
v.category             v.db_join              v.extrude
v.in_sites_all         v.mkgrid               v.net_spanningtree
v.overlay              v.select               v.univar
v.centroids            v.db_reconnect_all     v.generalize
v.in_wfs               v.neighbors            v.net_steiner
v.pack                 v.split                v.unpack
v.class                v.db_renamecolumn      v.hull
v.info                 v.net                  v.net_timetable
v.parallel             v.support              v.vect_stats
v.clean                v.db_select            v.in_ascii
v.kcv                  v.net_alloc            v.net_visibility
v.patch                v.surf_bspline         v.vol_rst
v.colors               v.db_univar            v.in_db
v.kernel               v.net_allpairs         v.normal
v.perturb              v.surf_idw             v.voronoi
v.colors_out           v.db_update            v.in_dxf
v.krige                v.net_bridge           v.out_ascii
v.proj                 v.surf_rst             v.what
v.convert              v.delaunay             v.in_e00
v.label                v.net_centrality       v.out_dxf
v.qcount               v.timestamp            v.what_rast
v.convert_all          v.dissolve             v.in_geonames
v.lidar_correction     v.net_components       v.out_gps
v.random               v.to_3d                v.what_rast3
v.db_addcolumn         v.distance             v.in_gns
v.lidar_edgedetection  v.net_connectivity     v.out_ogr
v.rast_stats           v.to_db                v.what_vect
v.db_addtable          v.drape                v.in_lines
v.lidar_growing        v.net_distance         v.out_postgis
v.reclass              v.to_points


I'm not able to understand who is raising the exception and why...
I always believed that the auto-completion was provided by the __dir__
magic methods, but the __dir__ method in the Metaclass instance it
seems to work without problems:

In [2]: dir(v)
Out[2]:
[u'buffer',
 u'build',
 u'build_all',
 u'build_polylines',
 u'category',
...
 u'what_rast',
 u'what_rast3',
 u'what_vect']


Someone has a deeper understanding on how the auto-complete works on
ipython/GRASS shell, Do you have any idea on where could be the
problem and how we could fix it?

Thanks

Pietro

[0] http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/pygrass/modules/shortcuts.py


More information about the grass-dev mailing list