Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'locations' #37

Open
mazepa-pipeline opened this issue Dec 22, 2020 · 6 comments
Open

KeyError: 'locations' #37

mazepa-pipeline opened this issue Dec 22, 2020 · 6 comments

Comments

@mazepa-pipeline
Copy link

Hello there. Thank you for sharing the script. Unfortunately I am having two issues as described below. As I am a beginner in Python, I am grateful if anyone can tell me what I am doing wrong. Regards.

Traceback (most recent call last):
File "/Users/user/hello/location_history_json_converter.py", line 574, in
sys.exit(main())
File "/Users/user/hello/location_history_json_converter.py", line 542, in main
items = data["locations"]
KeyError: 'locations'

@MarkMichaelis
Copy link

Not that this is any help, but I am seeing the same issue (albeit on different lines). Did you find a workaround?

@MarkMichaelis
Copy link

The issue appears to be unique to the "month" files (e.g.2021_FEBRUARY.json) rather than the location history.json file (the latter completes without error).

@InigoMoreno
Copy link

@MarkMichaelis When I downloadad the takeout, I only got month files. How do you get the location history.json?

@silvioschwarz
Copy link

I got the same Problem.
However, when I donwloaded my location history, I got a Records.json which seems to contain all data.

Using this Records.json works perfectly.

@rickprice
Copy link

I just created a PR that should fix this, but its untested.

@MathewBlanc
Copy link

MathewBlanc commented Mar 16, 2023

I've also just encountered this issue (although my error more closely matches #55).

Taking a look at the monthly files (eg. 2023_FEBRUARY.json) vs. the complete record (i.e. Records.json), they have a completely different structure.

While the Records file lists out individual location points keyed by locations, the monthly files are keyed by timeline Objects and are further split into activitySegment and placeVisit:

Records file entry:

"locations": [{ "latitudeE7": XXXXXXXXX, "longitudeE7": XXXXXXXXX, "accuracy": 36, "activity": [{ "activity": [{ "type": "STILL", "confidence": 49 }, { "type": "IN_VEHICLE", "confidence": 31 }, { "type": "UNKNOWN", "confidence": 13 }, { "type": "ON_FOOT", "confidence": 5 }, { "type": "WALKING", "confidence": 5 }, { "type": "ON_BICYCLE", "confidence": 3 }], "timestamp": "2015-08-05T00:54:27.596Z" }], "source": "WIFI", "deviceTag": XXXX, "timestamp": "2015-08-05T00:55:27.715Z" },...

vs

Monthly record:

"timelineObjects": [{ "activitySegment": { "startLocation": { "latitudeE7": XXXXXXXXX, "longitudeE7": XXXXXXXXX, "sourceInfo": { "deviceTag": XXXXXXXXX } }, "endLocation": { "latitudeE7": XXXXXXXXX, "longitudeE7": XXXXXXXXX, "sourceInfo": { "deviceTag": XXXXXXXXX } }, "duration": { "startTimestamp": "2023-02-01T06:00:21.231Z", "endTimestamp": "2023-02-01T06:09:31.765Z" }, "distance": 711, "activityType": "WALKING", "confidence": "HIGH", "activities": [{ "activityType": "WALKING", "probability": 93.14038753509521 }, {...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants