Hey Jonathan,
I don't know the specifics of how to configure the standard Python logger.
I just want to offer that you might have a better time with a debugger,
which lets you see and change program state at breakpoints. Python being an
interpreted language it is one of the absolute easiest languages to debug.
Pycharm is great and free.

You can set breakpoints in any python code. Then set pycharm to running
bean-extract's entry script:
https://github.com/beancount/beancount/blob/v2/bin/bean-extract



On Sun, May 30, 2021, 14:15 [email protected] <[email protected]> wrote:

> I see this on the wiki:
>
> Configuring Logging
>
> Python's logging module is used by the smart_importer module. The
> according log level can be changed as follows:
> import logging
> logging.getLogger('smart_importer').setLevel(logging.DEBUG)
>
> Where do I put this code? The program being executed is bean-extract. It
> reads in a file (e.g. Jonathan_smart.import in my case). If I put those two
> lines in that file I don't see any console logging occurring. I'm not that
> familiar with logging so trying to read the docs and understand how to
> configure.
>
> thanks,
> Jonathan
>
> On Sunday, May 30, 2021 at 11:01:00 PM UTC+12 [email protected] wrote:
>
>> I'm getting this same error as well now on a new account I'm adding. I'm
>> not sure how to turn logging on. Sorry if this is a basic question but is
>> there a flag I can invoke set when I invoke bean-extract?  Or do I add a
>> line in the code with predictor.py? It still is generating some
>> predictions. I'm invoking the code as follows:
>>
>> bean-extract -e journal/accounts.beancount jonathan_smart.import
>> ~/staging/my_credic_card.ofx > ~/staging/my_credit_card.ofx.extract
>> and I get this: "Cannot train the machine learning model because there is
>> only one target."
>>
>> but the file contains the extracted beancount statements and some
>> predictions.
>> On Thursday, December 3, 2020 at 1:17:22 PM UTC+13 [email protected]
>> wrote:
>>
>>> Ah that did it Eric! Thanks.
>>>
>>> I'm still getting no changed payees or postings but could be my data. My
>>> payees in the .beancount file are pretty rough ie "AMAZON.COM*
>>> MK5LX0H60AMZN.COM/BILL" and don't have a ton of data "Filtered training
>>> data to 21 of 133 entries" so maybe that's why. Anyway this is exciting
>>> thank you.
>>>
>>> Brian
>>>
>>> Brian McGee
>>> p. 781.856.8523
>>> http://www.brianmcgee.tv
>>>
>>> On Wed, Dec 2, 2020 at 3:55 PM Eric Glanz <[email protected]> wrote:
>>>
>>>> The two hooks are going to be applied in the order that they appear in
>>>> the array.  My guess is that the first 3 debug lines are from the
>>>> PredictPostings hook, followed by 2 debug lines from PredictPayees.
>>>>
>>>> My guess is that out of your 42 transactions only one has a payee
>>>> listed or multiple transactions have the same payee.  The rules for
>>>> payee/narration tripped me up at first, so you might want to review the
>>>> docs for payee and narration here:
>>>> https://beancount.github.io/docs/beancount_language_syntax.html#payee-narration
>>>>
>>>> Hope this helps!
>>>>
>>>> Eric
>>>>
>>>>
>>>>
>>>> On Wed, Dec 2, 2020 at 4:03 PM Brian McGee <[email protected]> wrote:
>>>>
>>>>> Thanks so much Aaron —
>>>>>
>>>>> I actually have 42 of the transactions from that account in my
>>>>> finances2020.beancount and am attempting to import 28 transactions with 
>>>>> the
>>>>> same account. Maybe because I pass in the account in the .import file
>>>>> rather than explicitly in the importer?
>>>>>
>>>>> brianCheck = usaa.USAABankImporter(
>>>>> 'Assets:USAA:PersonalChecking',
>>>>>
>>>>>
>>>>> Brian McGee
>>>>> p. 781.856.8523
>>>>> http://www.brianmcgee.tv
>>>>>
>>>>>
>>>>> On Wed, Dec 2, 2020 at 11:28 AM Aaron Lindsay <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> It's hard to make perfect sense of your DEBUG prints since I don't
>>>>>> know where in the code you inserted them, but is it possible you only 
>>>>>> have
>>>>>> 42 transactions total in finances2020.beancount and only 1 against the
>>>>>> account you're importing into?
>>>>>>
>>>>>> -Aaron
>>>>>>
>>>>>> On Wednesday, December 2, 2020 at 2:16:12 PM UTC-5
>>>>>> [email protected] wrote:
>>>>>>
>>>>>>> Smart Importer appears to be working but I cannot get it to train
>>>>>>> properly (I think, I'm green). Is this the right place for this 
>>>>>>> question?
>>>>>>> Thanks so much.
>>>>>>>
>>>>>>> Here is my logging debug:
>>>>>>> DEBUG - Calling the importer's extract method.
>>>>>>> DEBUG - Filtered training data to 42 of 134 entries.
>>>>>>> DEBUG - Trained the machine learning model. DEBUG - Added
>>>>>>> predictions to transactions.
>>>>>>> DEBUG - Filtered training data to 42 of 134 entries.
>>>>>>> WARNING - Cannot train the machine learning model because there is
>>>>>>> only one target.
>>>>>>>
>>>>>>> my bean-extract call:
>>>>>>> bean-extract -e finances2020.beancount personal.import
>>>>>>> documents/preImport/renamed
>>>>>>>
>>>>>>> applying hooks:
>>>>>>> apply_hooks(brianCheck, [PredictPostings(), PredictPayees()]),
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to a topic in
>>>>>> the Google Groups "Beancount" group.
>>>>>> To unsubscribe from this topic, visit
>>>>>> https://groups.google.com/d/topic/beancount/Z22nmCYH1Qw/unsubscribe.
>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>> [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/beancount/b32ac673-610c-4a82-8935-be08612b04bdn%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/beancount/b32ac673-610c-4a82-8935-be08612b04bdn%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/CAONa%2BnTmVcFJu%2BS_Au-DAWsvHPCt8BmyReqbQTW24Y2EuY2trg%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/beancount/CAONa%2BnTmVcFJu%2BS_Au-DAWsvHPCt8BmyReqbQTW24Y2EuY2trg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Beancount" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/beancount/Z22nmCYH1Qw/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>>
>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/beancount/CA%2BEB4JLOJAE90tOgPmcdrLYYV7hv2-vm%2BZxnAfCdvFQuWAwEXg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/beancount/CA%2BEB4JLOJAE90tOgPmcdrLYYV7hv2-vm%2BZxnAfCdvFQuWAwEXg%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/57faec7f-65f4-4cd9-8bc9-0733eae54323n%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/57faec7f-65f4-4cd9-8bc9-0733eae54323n%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/CACGEkZuwKJhx-2t9ZTdNPZDJxCUnd1O%3D4dNGuptsZuOEHXSrGw%40mail.gmail.com.

Reply via email to