today() error

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
joleenf
Posts: 1120
Joined: Mon Jan 19, 2009 7:16 pm

today() error

Post 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
User avatar
tomw
Posts: 296
Joined: Tue Dec 23, 2008 3:40 pm

Re: today() error

Post by tomw »

Do this:

Code: Select all

from datetime import date
date.today()
User avatar
joleenf
Posts: 1120
Joined: Mon Jan 19, 2009 7:16 pm

Re: today() error

Post 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
Post Reply