Two things:
1. You shouldn't have to define file_account(). How have you configured 
your importer? (i.e., the config file that you pass to bean-file)?

2. 'file_read_done' issue might be a bug. Can you please file a bug at 
https://github.com/redstreet/beancount_reds_importers ?
With the versions of beancount, beangulp (if you're using that), and 
reds-importers you're using ('pip freeze' should tell you).

Fix might be to add 'self.initialize_reader(file)' at the beginning of this 
method 
<https://github.com/redstreet/beancount_reds_importers/blob/51597c8ca0bc7dba913267a52ea241e538bc1097/beancount_reds_importers/libreader/csvreader.py#L112>,
 
but I want to figure out what caused this (perhaps an upstream change).

On Friday, November 12, 2021 at 8:12:43 AM UTC-8 tbra...@gmail.com wrote:

> Thank you for your help, RedS
>
> As a first step. I tried to modify copy your Disvcover --as well as the 
> exisiting Amex -- importer, switing the ofxreader with csvreader. I also 
> kept all of my mapping declarations going from csv "fields" to beancount 
> narrative fields. 
> I wasn't able to get that to work quite right. I did finally bring over 
>     def file_account(self, _):
>         return self.config['main_account']
> ...and it finally worked. However, I then get an error from bean-file: 
> unexpected error: 'AmexCCImporter' object has no attribute 'file_read_done'
>
> *This error is captured and the csv file is moved to the right place.* The 
> error might have been a bigger problem if I hadn't already "ingested" the 
> file into my beancount ledger.
>
> But just to dig in a little further...
> file_read_done is defined in ...reds_importers.libreader.csvreader. So, I 
> don't know why the stack is trying to retrieve this value from 
> 'AmexCCImporter'.
>
>
> I am working on the ofxget implementation next - will post results when I 
> have them. If successful, it will sort of nullify this other effort, but I 
> did learn something! 
>
> P.S. I don't know what's going on with the Times/Serif font in the middle 
> of this post. I couldn't change that back to the normal Sans Serif text.
> On Thursday, November 11, 2021 at 2:03:42 AM UTC-5 redst...@gmail.com 
> wrote:
>
>> Hello Tim,
>> That method is in beancount_reds_importers/libreader/reader.py, see here 
>> <https://github.com/redstreet/beancount_reds_importers/blob/51597c8ca0bc7dba913267a52ea241e538bc1097/beancount_reds_importers/libreader/reader.py#L23>.
>>  
>> If you imported the class correctly, that error should not occur:
>>
>> class AmexCCImporter(banking.Importer, csvreader.Importer):
>>    def custom_init(self):
>>      # blah blah: Look at discover/__init__.py and replace ofxreader with 
>> csvreader. 
>>
>> Let me know if that worked.
>> But the more interesting answer to your question is: have you setup direct 
>> downloads 
>> <https://reds-rants.netlify.app/personal-finance/direct-downloads/> (vs 
>> logging in via a browser)? If so, you'll get ofx from Amex, all from the 
>> command line that you can stick into a script. I checked my Amex two 
>> minutes ago, works fine and dandy:
>>
>> ofxget stmt --nokeyring -u yourusername --password $(pass 
>> beancount/amex_card) amex -c 'CODECODE|last5' > ~/Downloads/amex_card.ofx
>>
>> There's a one-time step to get your unique CODECODE, and I forget how 
>> it's done, but it's a pretty simple, single step IIRC, using ofxget. Post 
>> here if you're unable to get your code, and I'll try to dig up what I did.
>>
>> RedS.
>>
>> On Wednesday, November 10, 2021 at 11:57:23 AM UTC-8 tbra...@gmail.com 
>> wrote:
>>
>>> Additional information: Here is my __init__
>>>
>>> class AmexCCImporter(importer.ImporterProtocol):
>>>     def __init__(self, account, lastfour):
>>>         self.account = account
>>>         self.lastfour = lastfour
>>> The account does come through in the transaction narrative that is 
>>> generated. However, it's not picked up by the file.py routine.
>>> On Wednesday, November 10, 2021 at 2:44:46 PM UTC-5 tbra...@gmail.com 
>>> wrote:
>>>
>>>> Hi,
>>>> I've previously relied very heavily on *red's importers* for my import 
>>>> and filing needs. They worked great up to the point when my Amex switched 
>>>> over from ofx to csv's -- the only options for statement/transaction 
>>>> downloads are excel, csv, and pdf. 
>>>>
>>>> I think I have a working importer for the new Amex csv's, but when I 
>>>> attempt to archive via bean-file, I receive the error:
>>>> ERROR:root:No account provided by importers: <<object.class of my 
>>>> importer>>
>>>>
>>>> I think I'm missing a "return account" statement or similar but can't 
>>>> quite figure it out from the docs or red's other importers. I'm sure 
>>>> it's there but can't identify it.
>>>>
>>>> Thanks for reading (and I hope answering),
>>>> Tim
>>>>
>>>

-- 
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/2398104a-2ef9-4772-bc6a-ddccb96c8596n%40googlegroups.com.

Reply via email to