csingley / ofxtools

Python OFX Library
Other
301 stars 68 forks source link

TypeError checking OFX version in Client.py #88

Closed davraamides closed 4 years ago

davraamides commented 4 years ago

I'm getting an error processing OFX files

  File "/Users/david/env/finfo/lib/python3.8/site-packages/ofxtools/Client.py", line 437, in signon
    if self.version < 103:
TypeError: '<' not supported between instances of 'str' and 'int'

self.version is a string which I believe Client reads from either the .cfg file or from the OFX header. This used to work in 0.8.16 but I recently updated to 0.8.21 and started hitting this. Did something change where I need to use it differently?

csingley commented 4 years ago

How are you calling OFXClient.signon()? Is this from the ofxget script, or are you calling it yourself?

The version gets set by OFXClient.__init__(). It's supposed to be an int.

Just a shot in the dark... is it possible that you upgraded the ofxtools package, but not the version of the ofxget script it dropped on initial install?

davraamides commented 4 years ago

Thanks for the hint. I am creating my own client instance and was using the value I read from the .cfg file - as a string. So that bug was in my code for a long time but was never hitting a case where it was used as an int. The line testing against version 103 was in the updated Client.py which exposed my bug. All good now and thanks for the quick response!

csingley commented 4 years ago

Yeah, in case you hadn't noticed, I've pretty much gone all-in on the type hints. Do consider them to be a kind of "super-documentation" for the various modules and functions.

Glad it's so easy to clear up.