MoritzR/fints2ledger

fints2ledger can't find data/pyfints.py

Closed this issue · 5 comments

varac commented

So finally I'm getting to try the new version 😄

I installed fints2ledger by downloading it into ~/bin/download, but it fails to start:

$ fints2ledger                                     
python3: can't open file '/home/varac/bin/download/data/pyfints.py': [Errno 2] No such file or directory

fints2ledger: PyFintsError "Failed to get FinTS transactions, check the message above."

When I symlink ~/bin/download/data to the data/ dir of the git project checkout it works, so I can work around this but it would be nice to fix this.

varac commented

I also need to place my template.txt in this directory, otherwise it's not recognized by fints2ledger. It would be great if it could stay in the config dir as before.

python3: can't open file '/home/varac/bin/download/data/pyfints.py'

That path looks correct though, doesn't it? Is the file present at that directory?

I am especially confused because it should specifically look for the files in the data directory next to the executable. This also works fine on my machineâ„¢.
Can you explain more what you mean by symlinking to the data/ dir? I don't fully understand the file structure that works for you vs the one that does not work.

Regarding the template.txt file. I move it out of the .config directory intentionally. My reasons for this are the following:

  • The template.txt in the .config directory was never picked up, even though it was automatically created there if not present. Instead, it looked for the template file in the current working directory.
  • Instead of fixing this, I assumed that no one was actually using this feature, so I hid it. This works fine for me because it keeps open the possibility of using hledger to add transactions in the future. This could make something like #17 easier to implement, since a fixed template wouldn't work in this case anyway.

Is fints2ledger actually picking up the template file that you want? If so, what are you customizing there?
If some customization is needed, I would rather add back a more limited variation of the template file.

varac commented

That path looks correct though, doesn't it? Is the file present at that directory?

I am especially confused because it should specifically look for the files in the data directory next to the executable. This also works fine on my machineâ„¢.
Can you explain more what you mean by symlinking to the data/ dir? I don't fully understand the file structure that works for you vs the one that does not work.

Sorry, that's on me. I'm using https://github.com/zyedidia/eget for installing binaries from GH releases, and it only extracted the binary and not the data/ dir.

varac commented

This could make something like #17 easier to implement, since a fixed template wouldn't work in this case anyway.

Oh right, that makes sense, haven't thought of that !

Is fints2ledger actually picking up the template file that you want? If so, what are you customizing there?
If some customization is needed, I would rather add back a more limited variation of the template file.

I overrode the shipped template with my custom template, and it works for me well. It looks like this:

{date} ? "{payee}" "{purpose}"
    ; md5sum: {md5sum}
    type: "{posting}"
    {debitAccount:<80}  {debit} {currency}
    {creditAccount:<80}   {credit} {currency}

Iirc, I needed to put the payee in quotes because of payees with spaces in them.

Interesting template!

Release 1.2.0 includes the following changes:

  • The template.txt file is read from the fints2ledger config directory if present
  • The release no longer includes any extra data files, just the binary, meaning that you should be able to use https://github.com/zyedidia/eget now

The option of using template.txt as a means for customizing the output will stay for the near (probably far) future. It's not easy to replace.