Page 1 of 1

today() error

Posted: Tue Apr 11, 2017 7:09 pm
by joleenf
Hi,

I am seeing the following error when running today()

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 108, in today
AttributeError: 'instancemethod' object has no attribute 'today'

My office mate does not see this error when he runs on his computer.

I get the same error with the following code:

Code: Select all

from datetime import datetime as dt
dateFormat = None
dateFormat = dateFormat or '%Y%j'
dt.date.today().strftime(dateFormat)


Any ideas on how to diagnose the problem?

Thanks,
Joleen

Re: today() error

Posted: Tue Apr 11, 2017 7:23 pm
by tomw
Do this:

Code: Select all

from datetime import date
date.today()

Re: today() error

Posted: Wed Apr 12, 2017 2:39 pm
by joleenf
Thanks Tom. I found the problem in my jython library. I had used the following import at the top of the library, clobbering the datetime namespace which is used in the today() function.

from datetime import datetime

Joleen