ofxparse icon indicating copy to clipboard operation
ofxparse copied to clipboard

'str' object has no attribute 'strftime' in ofxprinter

Open aforch opened this issue 6 years ago • 1 comments

I'm encountering an issue when attempting to utilize the ofxprinter write function. The error info is below:

Traceback (most recent call last): File "ofx_parse.py", line 32, in printer.write(tabs=0) File "/Users/adam/miniconda3/lib/python3.6/site-packages/ofxparse/ofxprinter.py", line 200, in write self.writeToFile(f) File "/Users/adam/miniconda3/lib/python3.6/site-packages/ofxparse/ofxprinter.py", line 190, in writeToFile self.writeOfx(tabs=tabs) File "/Users/adam/miniconda3/lib/python3.6/site-packages/ofxparse/ofxprinter.py", line 177, in writeOfx self.writeBankMsgsRsv1(tabs=tabs) File "/Users/adam/miniconda3/lib/python3.6/site-packages/ofxparse/ofxprinter.py", line 167, in writeBankMsgsRsv1 self.writeStmTrs(tabs=tabs) File "/Users/adam/miniconda3/lib/python3.6/site-packages/ofxparse/ofxprinter.py", line 129, in writeStmTrs self.printDate(acct.statement.start_date) File "/Users/adam/miniconda3/lib/python3.6/site-packages/ofxparse/ofxprinter.py", line 43, in printDate strdt = dt.strftime('%Y%m%d%H%M%S') AttributeError: 'str' object has no attribute 'strftime'

aforch avatar Sep 09 '18 20:09 aforch

The printDate method of an OfxPrinter object should be called with a first parameter dt.

dt should be a datetime object which does have a strftime method. Looks like in this case the printDate method was called with dt being a string instead of a datetime.

rdsteed avatar Oct 24 '18 03:10 rdsteed