After changing the import as a from-import
i’m running into this error:
from datetime import datetime, date, timedelta
today = date.today()
from time import mktime
from feedparser import feedparser
import settings
def check_calendar():
d = feedparser.parse(settings.personal_calendar_feed)
for entry in d.entries:
if(date.fromtimestamp(mktime(entry.date_parsed))==today):
Traceback (most recent call last):
File computer.py", line 734, in <module>
check_calendar()
File "computer.py", line 210, in check_calendar
if(date.fromtimestamp(mktime(entry.date_parsed))==today):
AttributeError: 'function' object has no attribute 'fromtimestamp'
It says
in the error. Apparently you may have a function named “date” in your code. Since Python allows you to use any name, and new conflicting names will override the older ones.
Instead, when python can’t find a function from a module or object, it usually says type object has no attribute or module has no attribute, like if I want to call “fromtimes” :
You may want to check your code carefully again.