copy activity do not accept optional keyword arguments

Create issue
Issue #45 resolved
giuseppe cardellini created an issue

It seems that something is wrong with activity.copy()

In [3]: fur=Database('mydb')

In [4]: unit=fur.random()

In [5]: unit.copy(code='test',name='test')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-14f9fd67177c> in <module>()
----> 1 unit.copy(code='test',name='test')

/home/giuseppec/miniconda3/envs/bw2_LU/lib/python3.4/site-packages/bw2data/project.py in writable_project(wrapped, instance, args, kwargs)
    368     if projects.read_only:
    369         raise ReadOnlyProject(READ_ONLY_PROJECT)
--> 370     return wrapped(*args, **kwargs)

/home/giuseppec/miniconda3/envs/bw2_LU/lib/python3.4/site-packages/bw2data/backends/peewee/proxies.py in copy(self, code, **kwargs)
    233             activity[key] = value
    234         for k, v in kwargs.items():
--> 235             setattr(activity._data, k, v)
    236         activity._data[u'code'] = str(code or uuid.uuid4().hex)
    237         activity.save()

AttributeError: 'dict' object has no attribute 'name'

also passing other keyword the error is the same

Comments (1)

  1. Log in to comment