Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it #4

Open
nagybal opened this issue Jul 15, 2020 · 4 comments
Open

How to use it #4

nagybal opened this issue Jul 15, 2020 · 4 comments
Assignees

Comments

@nagybal
Copy link

nagybal commented Jul 15, 2020

I believe I have successfully installed the plug-in. How to use it?

bigb@ipoly-elmentary:~/Downloads/ofxstatement-otp-master$ pip3 install .
Processing /home/bigb/Downloads/ofxstatement-otp-master
Collecting ofxstatement (from ofxstatement-otp==0.0.4)
  Using cached https://files.pythonhosted.org/packages/33/c2/3f1f0dfa87245bd9880f3aecfc37e0036949d886d712fecdcd5884506280/ofxstatement-0.6.5.tar.gz
Collecting appdirs>=1.3.0 (from ofxstatement->ofxstatement-otp==0.0.4)
  Downloading https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl
Collecting setuptools (from ofxstatement->ofxstatement-otp==0.0.4)
  Downloading https://files.pythonhosted.org/packages/8e/11/9e10f1cad4518cb307b484c255cae61e97f05b82f6d536932b1714e01b47/setuptools-49.2.0-py3-none-any.whl (789kB)
    100% |████████████████████████████████| 798kB 1.1MB/s 
Building wheels for collected packages: ofxstatement-otp, ofxstatement
  Running setup.py bdist_wheel for ofxstatement-otp ... done
  Stored in directory: /home/bigb/.cache/pip/wheels/b0/9d/49/1e438123f123bdd6c71e7fc166bd57f60a60cf8bc06f21194f
  Running setup.py bdist_wheel for ofxstatement ... done
  Stored in directory: /home/bigb/.cache/pip/wheels/3f/8e/6e/95ed379579a00e46ad52040928f03c5c86e3e069723ca90070
Successfully built ofxstatement-otp ofxstatement
Installing collected packages: appdirs, setuptools, ofxstatement, ofxstatement-otp
Successfully installed appdirs-1.4.4 ofxstatement-0.6.5 ofxstatement-otp-0.0.4 setuptools-49.2.0
@gyp gyp self-assigned this Sep 23, 2020
@gyp
Copy link
Owner

gyp commented Sep 23, 2020

Uhh, sorry for the incredibly slow response. For some reason, GitHub never notified me about it.

Did you run into any specific issues? It's not apparent for me based on the log you pasted.

When installed from pip, it simply adds itself as a plugin to ofxstatement, so you'll be able to use it as a converter type. ofxstatement list-plugins should show it as a plugin and you could use it as an argument of the convert command, eg, ofxstatement -t otp input.xml output.ofx

@nagybal
Copy link
Author

nagybal commented Nov 6, 2020

My bad, I did read the main manual and figured it out. I did install using pip but I still can't convert. Any idea?

vkhunyadi-iMac:Downloads bigb$ pip3 install ofxstatement-otp
Requirement already satisfied: ofxstatement-otp in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (0.0.4)
Requirement already satisfied: ofxstatement in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from ofxstatement-otp) **(0.6.5)**
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from ofxstatement->ofxstatement-otp) (47.1.0)
Requirement already satisfied: appdirs>=1.3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from ofxstatement->ofxstatement-otp) (1.4.4)
vkhunyadi-iMac:Downloads bigb$ ofxstatement convert -t otp HUF.xml HUF.ofx
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/ofxstatement", line 11, in <module>
    load_entry_point('ofxstatement==0.6.5', 'console_scripts', 'ofxstatement')()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/tool.py", line 178, in run
    return args.func(args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/tool.py", line 149, in convert
    statement = parser.parse()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/plugins/otp.py", line 29, in parse
    tree = ET.parse(self.filename)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xml/etree/ElementTree.py", line 1202, in parse
    tree.parse(source, parser)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/xml/etree/ElementTree.py", line 595, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 41, column 312

The EUR statement fails as well but on different lines.

vkhunyadi-iMac:Downloads bigb$ ofxstatement convert -t otp EUR.xml EUR.ofx
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/ofxstatement", line 11, in <module>
    load_entry_point('ofxstatement==0.6.5', 'console_scripts', 'ofxstatement')()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/tool.py", line 178, in run
    return args.func(args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/tool.py", line 149, in convert
    statement = parser.parse()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/plugins/otp.py", line 31, in parse
    self._parse_statement_properties(tree)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/ofxstatement/plugins/otp.py", line 39, in _parse_statement_properties
    bnk = stmt.find('./Acct/Svcr/FinInstnId/Nm')
AttributeError: 'NoneType' object has no attribute 'find'

@gyp
Copy link
Owner

gyp commented Nov 8, 2020

Hmm, these seem to be genuine parsing errors, I have encountered those many times, as OTP tends to treat the OFX standard loosely and keeps introducing new changes.

The HUF error seems to indicate that the XML itself is not well-formed -- maybe one of the tags are not closed, escaping is broken or something else. There's not much to do about it as there's no mechanism in ofxstatement to preprocess these files, and adding it would be a huge overkill (you can try though!). You can try looking at HUF.xml itself (based on the traceback, in line 41, column 312), to see what's going on, and maybe report it to OTP if something's genuinely wrong. You can also fix it manually, of course, but that pretty much beats the purpose of having a tool like this to be able to automate conversions. When I encountered such problems, they usually just went away after a few days.

The EUR.xml is more specific to this module itself, but I could not reproduce it and it also signals a serious issue with the XML exported by OTP. The file should contain a node called <Rpt>, under which everything else is listed. If it does not have it, the conversion is not possible. Are you sure there are entries within the selected timeframe for the export or you managed to download the entire file?

If you send over those XML files, I can also take a look at them. But they, of course, contain highly sensitive information of your financial transactions, so please manually sanitize them before you do that.

@nagybal
Copy link
Author

nagybal commented Nov 8, 2020

If you send over those XML files, I can also take a look at them. But they, of course, contain highly sensitive information of your financial transactions, so please manually sanitize them before you do that.

For the best troubleshooting possible I would rather send the XML files over via direct message. Please email me something [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants