#2060: Unable to make a deepcopy of a pygrass Module object
---------------------------------------+------------------------------------
Reporter: huhabla | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: unspecified
Keywords: pygrass, Module, deepcopy | Platform: All
Cpu: All |
---------------------------------------+------------------------------------
I am trying to make copies of a single pygrass.modules.Module() object
using copy.deepcopy:
{{{
>>> import grass.pygrass as pg
>>> m = pg.modules.Module("g.region", flags="p", run_=False)
>>> m.run()
projection: 99 (Lambert Conformal Conic)
zone: 0
datum: nad83
ellipsoid: a=6378137 es=0.006694380022900787
north: 80
south: 0
west: 0
east: 120
nsres: 10
ewres: 10
rows: 8
cols: 12
cells: 96
>>> import copy
>>> n = copy.deepcopy(m)
>>> n.run()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/soeren/src/grass7.0/grass_trunk/dist.x86_64-unknown-linux-
gnu/etc/python/grass/pygrass/modules/interface/module.py", line 282, in
run
if self.inputs['stdin'].value:
KeyError: 'stdin'
}}}
But it fails with a key error. Looks like (thanks for Pietro's
investigation) that the _getattr_ function in
grass.pygrass.modules.interface.typedict may be the problem.[1]
[1] http://www.peterbe.com/plog/must__deepcopy__
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2060>
GRASS GIS <http://grass.osgeo.org>