jseutter / ofxparse

Ofx file format parser for Python
http://sites.google.com/site/ofxparse/
MIT License
204 stars 119 forks source link

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

Open aforch opened 6 years ago

aforch commented 6 years ago

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'

rdsteed commented 5 years ago

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.