google-data-analyses icon indicating copy to clipboard operation
google-data-analyses copied to clipboard

AttributeError: 'datetime.datetime' object has no attribute 'timestamp'

Open greenlee opened this issue 5 years ago • 1 comments

Hello, New to python and haven't been able to figure this out. running python 2.7.18 in windows 10 command prompt. I put the latest error in the title, AttributeError: 'datetime.datetime' object has no attribute 'timestamp' . but prior to that, I was getting, Traceback (most recent call last): File "C:\google-data-analyses-master\get_visit_times.py", line 87, in data.clear() AttributeError: 'list' object has no attribute 'clear' . not sure if the two are related. I was able to bypass the clear error by commenting out the #data.clear() line. have lots of memory so figured why not. the latest error I get is bellow.

C:\google-data-analyses-master>get_visit_times.py Loading 'C:\google-data-analyses-master\Location History.json' ... JSON file loaded Extracting relevant data... Total number of points: 4171876 Traceback (most recent call last): File "C:\google-data-analyses-master\get_visit_times.py", line 95, in begin_ts = date_ymd_to_timestamp_ms(2019,01,01) File "C:\google-data-analyses-master\get_visit_times.py", line 24, in date_ymd_to_timestamp_ms return datetime.datetime(y,m,d).timestamp()#*1e3 AttributeError: 'datetime.datetime' object has no attribute 'timestamp'

greenlee avatar Jun 08 '20 00:06 greenlee

Hi ! You need to run the script with Python 3 instead of Python 2 ;)

matthieuheitz avatar Aug 12 '20 08:08 matthieuheitz