I also get 
    ad.commodity.meta["name"] if ad.commodity else "N/A",
KeyError: 'name'

 as in Tino Tuno's post.

It's because not all of my commodities have names.   After Google Finance's 
importer stopped working, I didn't have any reason to maintain my commodity 
directives.

I suggest installing some fall-backs, like so:

        name = 'N/A'
        if ad.commodity:
            name = ad.commodity.currency
        if 'name' in ad.commodity.meta:
            name = ad.commodity.meta["name"]
        rows.append((ad.account, name, status_str))




On Sunday, September 13, 2020 at 6:03:36 PM UTC-7 [email protected] wrote:

> I'm not sure I understand your comment. Just install google protobuf, 
> numpy, scipy, seaborn, matplotlib, and run from the v2 branch, it should 
> likely just work.
>
> I prototype things in experimental, and eventually promote them to the 
> core when they're got enough of a body and I've got good test coverage; I 
> think this discipline is the only way I've been able to support the core of 
> the project for 12+ years on my off time. But for v3 I want to make the 
> core part I'm supporting directly smaller (bean-price moved out, 
> bean-web/-report deprecated in favor of Fava, and bean-query will move to 
> its own repo) in order to be able to support it actively again (there's too 
> much there now for my bandwidth), so I need to figure out where new things 
> like that will go. It's possible this could just be its own project with 
> its own repo, not sure yet. In the long run I'd like for the Beancount repo 
> to become very lean and move away from also being where "Martin's 
> experiments with Beancount" happen, if you see what I mean. I see more than 
> 300 Beancount-related repos on Github, I'm sure I could define a few more 
> instead of doing everything in one place. Anyhow, I hope this makes sense.
>
>
>
>
> On Sun, Sep 13, 2020 at 8:33 PM Adam Wolenc <[email protected]> wrote:
>
>> I see. I don't need to build the world in order to get this script to 
>> work. Though I do need Python 3.7, and I would like to build the world, 
>> near HEAD, successfully at some point.
>>
>> On Sunday, September 13, 2020 at 2:29:24 PM UTC-7 [email protected] wrote:
>>
>>> Not until the returns code is moved out of experiments. I could do that 
>>> once I've blanketed it in unit tests.
>>>
>>> General speaking I want the v3 repo to be lighter and smaller so maybe 
>>> adding more officially supported code to v2 isn't wise yet, maybe I should 
>>> make that project another repo, I'm not sure. Maybe all those experiments 
>>> don't belong there. 
>>>
>>>
>>>
>>> On Sun, Sep 13, 2020, 16:29 Adam Wolenc <[email protected]> wrote:
>>>
>>>> Martin,
>>>> Please add 
>>>> numpy, scipy, seaborn, and matplotlib to requirements.txt
>>>>
>>>> On Sunday, September 13, 2020 at 9:20:54 AM UTC-7 [email protected] 
>>>> wrote:
>>>>
>>>>> Hi Martin,
>>>>>
>>>>> Just to clarify, I’m not too interested in the return project. Just 
>>>>> trying to help a bit the projects being a beta-tester ;-)
>>>>>
>>>>> What I did is: 
>>>>>
>>>>> 1.- Create an environment with `python3 -m venv env` and activating it 
>>>>> to don’t mix with my standard config.
>>>>> 2.- Install with pip3 the last ‘git clone’ for the v2 as you 
>>>>> indicated. Also all the dependencies needed. 
>>>>> 3.- Run “./configure.py -v bean/main.bean > configuracion" to have the 
>>>>> configuration file. There are lines like: 
>>>>>
>>>>> investment {
>>>>>     currency: “VTI”
>>>>>     asset_account: “Assets:Acciones:VTI”
>>>>>   }
>>>>>
>>>>> And 
>>>>>
>>>>> report {
>>>>>     name: “currency.VTI”
>>>>>     investment: “Assets:Acciones:VTI”
>>>>>   }
>>>>>
>>>>> One for each stock/ETF I have. Until there, no problems.
>>>>>
>>>>> 4. Create a directory “out” and run: “./compute_returns.py 
>>>>> bean/main.bean configuracion out”
>>>>> There is the first error: 
>>>>>
>>>>> FileNotFoundError: [Errno 2] No such file or directory: 
>>>>> ‘out/investments/Assets_Acciones_ABBV.org 
>>>>> <http://assets_acciones_abbv.org>'
>>>>>
>>>>> Well.. I imagined I need the directory investments.. Probably would be 
>>>>> nice if the directories and sub-directories are done automatically but 
>>>>> whatever, I did mkdir for out/investments and still errors about 
>>>>> signature 
>>>>> sub-sub directories, etc.
>>>>> I created all the subdirectories that gave me errors…
>>>>>
>>>>> 5. Finally I run: “./compute_returns.py bean/main.bean configuracion 
>>>>> out” takes a bit (3 or 4 seconds) Eureka!!! Is working!!!! But…no :-(
>>>>> I past the results here to avoid the mail too long…: 
>>>>> https://pastebin.com/LJ7j7B23
>>>>>
>>>>> Regards.
>>>>>
>>>>> Tino Tuno
>>>>> On 13 Sep 2020, 01:13 +0200, Martin Blais <[email protected]>, wrote:
>>>>>
>>>>> Thanks Tuno. 
>>>>> This is living in head of branch v2 at the moment.
>>>>> I'll release 2.3.2 with it just now.
>>>>>
>>>>> Keep in mind that you'll probably want to run from a git clone and 
>>>>> update regularly, because I'm going to improve this faster than releases 
>>>>> for a while.
>>>>>
>>>>>
>>>>> On Sat, Sep 12, 2020 at 5:29 PM Tuno Tunante <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Wow Martin, what a work! 
>>>>>> I’ve been trying a bit and after some missing/Install packages 
>>>>>> (protobuf, etc). The configure.py doesn’t work for me.
>>>>>>
>>>>>> Output:
>>>>>>
>>>>>> Host/returns# python3 configure.py main.bean
>>>>>> Traceback (most recent call last):
>>>>>>  File "configure.py", line 35, in <module>
>>>>>>  options_map: data.Options,
>>>>>> AttributeError: module 'beancount.core.data' has no attribute 
>>>>>> 'Options'
>>>>>>
>>>>>> Cannot find why the error.
>>>>>> The ‘bean-check main.bean' works well.
>>>>>>
>>>>>> My beancount is installed from pip3 and my version:
>>>>>> Beancount 2.3.1
>>>>>>
>>>>>> Regards.
>>>>>>
>>>>>>
>>>>>> Tino Tuno
>>>>>> On 12 Sep 2020, 21:25 +0200, Martin Blais <[email protected]>, wrote:
>>>>>>
>>>>>> I took a few weeks off, COVID-style (at home, cooking and coding). So 
>>>>>> I made some good progress on calculating returns from a Beancount 
>>>>>> ledger. 
>>>>>> I'm really excited to share this actually, because it worked so well! 
>>>>>>
>>>>>> The source code is located here:
>>>>>> https://github.com/beancount/beancount/tree/v2/experiments/returns
>>>>>> and I think it's general enough that you can use it on your own 
>>>>>> ledger.
>>>>>>
>>>>>> I'll need to cover it with unit tests and apply it to the example 
>>>>>> Beancount file before taking it out of "experiments/" but this should 
>>>>>> work 
>>>>>> now.
>>>>>>
>>>>>> I've documented the process here:
>>>>>> http://furius.ca/beancount/doc/returns 
>>>>>>
>>>>>> https://docs.google.com/document/d/1nPsMIunLnDvdsg6TSsd0PZb7jngojNpFlqnaX36WRp8/
>>>>>>
>>>>>> I'm looking forward to feedback, and especially comments from people 
>>>>>> who manage to make it run on their own ledger and produce useful results.
>>>>>> (The doc is open for comments in suggestion mode.)
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Beancount" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/beancount/CAK21%2BhNLfJcaD7RFcFsJ%2B-xbk90F3Gr40A8dC0ZQENfHg_QakA%40mail.gmail.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhNLfJcaD7RFcFsJ%2B-xbk90F3Gr40A8dC0ZQENfHg_QakA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Beancount" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/beancount/e04c3eff-5f00-42b0-a86d-de145e69bad6%40Spark
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/beancount/e04c3eff-5f00-42b0-a86d-de145e69bad6%40Spark?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Beancount" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>>
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/beancount/CAK21%2BhN6ndWJoyqPtuNKG77TJMmvwqgQfqb8iQL%2B_jmhxSge8A%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/beancount/CAK21%2BhN6ndWJoyqPtuNKG77TJMmvwqgQfqb8iQL%2B_jmhxSge8A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Beancount" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>>
>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/beancount/d3084ba9-9272-4281-b377-e9c07c9b5423n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/beancount/d3084ba9-9272-4281-b377-e9c07c9b5423n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/beancount/41d4e5c1-de3a-41c5-aae2-2c7a39ab99b5n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/beancount/41d4e5c1-de3a-41c5-aae2-2c7a39ab99b5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/2a6bf01f-ca97-4bd3-9d61-9c0ef75e4678n%40googlegroups.com.

Reply via email to