Opened 7 years ago

Closed 7 years ago

#2060 closed defect (fixed)

Unable to make a deepcopy of a pygrass Module object

Reported by: huhabla Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Python Version: svn-trunk
Keywords: pygrass, Module, deepcopy Cc:
CPU: All Platform: All

Description

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

Change History (2)

comment:1 Changed 7 years ago by huhabla

Version: unspecifiedsvn-trunk

comment:2 Changed 7 years ago by huhabla

Resolution: fixed
Status: newclosed

Fixed by Pietro.

Note: See TracTickets for help on using tickets.