Thanks Fin! I got it working now with your advice. I just had to google for 
what plugins are. Didn't know about them!

Dne úterý 12. prosince 2023 v 7:40:42 UTC+1 uživatel fin napsal:

> Petr Karvinsky wrote:
> > ------=_Part_104_143696874.1702332249395
> > Content-Type: multipart/alternative; 
> > boundary="----=_Part_105_1164241524.1702332249395"
> >
> > ------=_Part_105_1164241524.1702332249395
> > Content-Type: text/plain; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Thanks for the replies. I am doing this for the first setup of my 
> ledger.=
> >=20
> > Nevertheless, I think I want the extraction reproducible, creating the=20
> > ledger zero-to-present day each time the script is run. For that reason, 
> I=
> >=20
> > need an automated way for creating the open-account directives.
> >
> > @fin
> > that looks like what I need. I see the input to the function is a list 
> of=
> >=20
> > entries. But I am confused how to combine this with my multiple 
> importers.=
> >=20
> > In the way I have my script setup I do not have access to the combined=20
> > output entries (only standalone entries per-each-importer). Since 
> multiple=
> >=20
> > importers can access the same account, this would create redundant 
> open=20
> > directives. Perhaps you see something wrong with my setup? Here it is:
>
> the importers generate input but that input is only consumed
> later and that is when the open or closes are done. so i just
> put the plugin right at the top of my main ledger file and that
> takes care of it - i don't need to do anything else. if you 
> are for some reason using different main ledgers then put the
> plugin call right at the top of each main ledger.
>
> from what i read below i think you are making this much more
> complicated than it really is. one statement is all i used
> and i've not done anything else like what you are talking about
> below this point but i'm not reading it too closely right now
> so perhaps you are trying to do things i don't need to do
> myself...
>
> fin
>
>
> > I actually copied the bean-extract.py source code ( ugh) into a=20
> > bean-extract.py file which I launch from my IDE (so that i can attach=20
> > debugger inside my importers). And then I just do `bean-extract.py=20
> > config.import statements`. The contents of `config.import` is 
> basically=20
> > ```
> > CONFIG =3D [
> > bank1.Importer(),
> > bank2.Importer()
> > ]
> > ```
> > so I do not actually have access to the "entries" such that I could 
> insert=
> >=20
> > them into the `auto_accounts` function. The ledger is output by=20
> > `bean-extract` to console outside of my importers. I think I am doing=20
> > something wrong; I should not have to modify stuff inside 
> bean-extract,=20
> > right?
> > Dne pond=C4=9Bl=C3=AD 11. prosince 2023 v 10:56:27 UTC+1 u=C5=BEivatel 
> Red =
> > S napsal:
> >
> >> I imagine this is for first time setup of your ledger. Many options 
> exist=
> > .=20
> >> Here's a simple way: get a list of all accounts missing open 
> directives,=
> >=20
> >> and place them into your ledger. You can do this by running bean-check 
> (o=
> > r=20
> >> bean-query) and grepping for that error about missing directives.
> >>
> >> With my ledger having been setup and running, I only rarely add open=20
> >> directives---once in a bluemoon. That's the point of open directives:=20
> >> automation can book a transaction to an account I didn't manually open, 
> a=
> > nd=20
> >> therefore cause "leak."
> >>
> >> On Sunday, December 10, 2023 at 5:12:31=E2=80=AFAM UTC-8 Petr Karvinsky 
> w=
> > rote:
> >>
> >>> Hi everyone. I am having trouble understanding how are the open 
> account=
> >=20
> >>> directives created when using importers.
> >>>
> >>> I wrote a couple importers which work and the ledgers can be ingested 
> by=
> >=20
> >>> bean-web or interactive bean-query. I wnated to automatize my queries 
> by=
> >=20
> >>> running the non-interactive version or by running bean-report. 
> However, =
> > my=20
> >>> ledger (although working well with tools above) has a lot of errors:=20
> >>> missing open directives.
> >>>
> >>> I checked multiple repositories with examples of how to solve this but=
> >=20
> >>> full-text search never finds anything matching "open" in the source 
> code=
> > s.=20
> >>> So, how do these open instructions appear in people's ledgers? Are you 
> g=
> > uys=20
> >>> adding them manually? For all the hundreds of expense types? I find it 
> h=
> > ard=20
> >>> to believe this.
> >>>
> >>> Naively, I thought of just going thorugh all accounts from the 
> importer=
> >=20
> >>> and adding OPEN instruction for them but then, I have multiple 
> importers=
> >=20
> >>> each of them potentially creating postings accessing the same account 
> so=
> >=20
> >>> their open directives would be conflicting. Hacking around this seems 
> to=
> > o=20
> >>> complex and I am sure there is a solution to it...
> >>>
> >>> So, please, how do you create the open directives?
> >>>
> >>
> >
> > --=20
> > 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 e=
> > mail to beancount+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/=
> > beancount/37fcd7d0-3ae7-4070-b093-8b2572e538fan%40googlegroups.com.
> >
> > ------=_Part_105_1164241524.1702332249395
> > Content-Type: text/html; charset="UTF-8"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Thanks for the replies. I am doing this for the first setup of my 
> ledger. N=
> > evertheless, I think I want the extraction reproducible, creating the 
> ledge=
> > r zero-to-present day each time the script is run. For that reason, I 
> need =
> > an automated way for creating the open-account directives.<div><br 
> /></div>=
> ><div>@fin</div><div>that looks like what I need. I see the input to the 
> fun=
> > ction is a list of entries. But I am confused how to combine this with 
> my m=
> > ultiple importers. In the way I have my script setup I do not have 
> access t=
> > o the combined output entries (only standalone entries 
> per-each-importer). =
> > Since multiple importers can access the same account, this would create 
> red=
> > undant open directives. Perhaps you see something wrong with my setup? 
> Here=
> > it is:</div><div><br /></div><div>I actually copied the bean-extract.py 
> so=
> > urce code ( ugh) into a bean-extract.py file which I launch from my IDE 
> (so=
> > that i can attach debugger inside my importers). And then I just do 
> `bean-=
> > extract.py config.import statements`. The contents of `config.import` is 
> ba=
> > sically=C2=A0</div><div>```</div><div><div style=3D"color: rgb(8, 8, 
> 8);"><=
> > span style=3D"font-family: &quot;JetBrains Mono&quot;, 
> monospace;">CONFIG =
> >=3D [<br />bank1.Importer(),<br />bank2.Importer()<br 
> />]</span></div></div=
> >><div>```</div><div>so I do not actually have access to the "entries" 
> such =
> > that I could insert them into the `auto_accounts` function. The ledger 
> is o=
> > utput by `bean-extract` to console outside of my importers. I think I am 
> do=
> > ing something wrong; I should not have to modify stuff inside 
> bean-extract,=
> > right?</div><div class=3D"gmail_quote"><div dir=3D"auto" 
> class=3D"gmail_at=
> > tr">Dne pond=C4=9Bl=C3=AD 11. prosince 2023=C2=A0v=C2=A010:56:27 UTC+1 
> u=C5=
> >=BEivatel Red S napsal:<br/></div><blockquote class=3D"gmail_quote" style=
> >=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb(204, 204, 204); 
> padding=
> > -left: 1ex;"><div>I imagine this is for first time setup of your ledger. 
> Ma=
> > ny options exist. Here&#39;s a simple way: get a list of all accounts 
> missi=
> > ng open directives, and place them into your ledger. You can do this by 
> run=
> > ning bean-check (or bean-query) and grepping for that error about 
> missing d=
> > irectives.</div><div><br></div>With my ledger having been setup and 
> running=
> > , I only rarely add open directives---once in a bluemoon. That&#39;s the 
> po=
> > int of open directives: automation can book a transaction to an account 
> I d=
> > idn&#39;t manually open, and therefore cause 
> &quot;leak.&quot;<br><br><div =
> > class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Sunday, 
> Dec=
> > ember 10, 2023 at 5:12:31=E2=80=AFAM UTC-8 Petr Karvinsky 
> wrote:<br></div><=
> > blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 
> 0.8ex;border-left:1p=
> > x solid rgb(204,204,204);padding-left:1ex">Hi everyone. I am having 
> trouble=
> > understanding how are the open account directives created when using 
> impor=
> > ters.<div><br></div><div>I wrote a couple importers which work and the 
> ledg=
> > ers can be ingested by bean-web or interactive bean-query. I wnated to 
> auto=
> > matize my queries by running the non-interactive version or by running 
> bean=
> > -report. However, my ledger (although working well with tools above) has 
> a =
> > lot of errors: missing open directives.</div><div><br></div><div>I 
> checked =
> > multiple repositories with examples of how to solve this but full-text 
> sear=
> > ch never finds anything matching &quot;open&quot; in the source codes. 
> So, =
> > how do these open instructions appear in people&#39;s ledgers? Are you 
> guys=
> > adding them manually? For all the hundreds of expense types? I find it 
> har=
> > d to believe this.</div><div><br></div><div>Naively, I thought of just 
> goin=
> > g thorugh all accounts from the importer and adding OPEN instruction for 
> th=
> > em but then, I have multiple importers each of them potentially creating 
> po=
> > stings accessing the same account so their open directives would be 
> conflic=
> > ting. Hacking around this seems too complex and I am sure there is a 
> soluti=
> > on to it...</div><div><br></div><div>So, please, how do you create the 
> open=
> > directives?</div></blockquote></div></blockquote></div>
> >
> ><p></p>
> >
> > -- <br />
> > You received this message because you are subscribed to the Google 
> Groups &=
> > quot;Beancount&quot; group.<br />
> > To unsubscribe from this group and stop receiving emails from it, send 
> an e=
> > mail to <a href=3D"mailto:beancount+...@googlegroups.com";>beancount=
> > +unsub...@googlegroups.com</a>.<br />
> > To view this discussion on the web visit <a href=3D"
> https://groups.google.c=
> > 
> om/d/msgid/beancount/37fcd7d0-3ae7-4070-b093-8b2572e538fan%40googlegroups.c=
> > om?utm_medium=3Demail&utm_source=3Dfooter">
> https://groups.google.com/d/msgi=
> > d/beancount/37fcd7d0-3ae7-4070-b093-8b2572e538fan%40googlegroups.com
> </a>.<b=
> > r />
> >
> > ------=_Part_105_1164241524.1702332249395--
> >
> > ------=_Part_104_143696874.1702332249395--
> >
>
>

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/17f9376c-1263-4ef2-bc93-ba5e8afcef49n%40googlegroups.com.

Reply via email to