brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
8 stars 21 forks source link

copy activity do not accept optional keyword arguments #45

Closed aleksandra-kim closed 7 years ago

aleksandra-kim commented 8 years ago

Original report by giuseppe cardellini (Bitbucket: cardosan, GitHub: cardosan).


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

#!python

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

aleksandra-kim commented 7 years ago

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


This was fixed in commit 2ac5e6f, which was included in the 2.3.1 release, which came out on 2016-07-16.