ofxclient icon indicating copy to clipboard operation
ofxclient copied to clipboard

--download option throws exception under python3

Open smithbone opened this issue 6 years ago • 4 comments

If the --download option is used with python3 then a exception occurs.

File "/usr/local/bin/ofxclient", line 9, in load_entry_point('ofxclient==2.0.3', 'console_scripts', 'ofxclient')() File "/usr/local/lib/python3.5/dist-packages/ofxclient-2.0.3-py3.5.egg/ofxclient/cli.py", line 56, in run args.download.write(ofxdata.read()) TypeError: a bytes-like object is required, not 'str'

I fixed it locally by adding a .encode() call into the strings returned by ofxdata.read().

However, That's not a fix for both python2&3. I see account.py has some 2/3 support but account.download() doesn't use it.

smithbone avatar Mar 27 '18 18:03 smithbone

Why isn't adding .encode() a fix for 2&3? In Python2 the encode is basically a no-op and it is fixed in python3.

e2thenegpii avatar Jun 17 '18 05:06 e2thenegpii

Sorry. I missed a word or 2 and that is not very clear on what I meant. What I should have said is that I'm not claiming this is a complete fix for all python 2/3 compatibility issues. I've only fixed this specific instance that was throwing the exception.

smithbone avatar Jun 24 '18 21:06 smithbone

I fixed it locally by adding a .encode() call into the strings returned by ofxdata.read().

I have this exact issue and am struggling with where to implement the encode. Could you elaborate so I could patch mine?

bmcdonough avatar May 29 '20 13:05 bmcdonough

smithbone replied to my email directly and pointed out my issue. I was using the pip copy not the github copy. This issue is actually resolved

https://github.com/captin411/ofxclient/commit/60f0f49f54e6151e960c1175e8b2d0fe215774ae

bmcdonough avatar May 29 '20 20:05 bmcdonough