___Analyzing Data___ TypeError: '<' not supported between instances of 'int' and 'NoneType'
GarminDB version: 3.6.0 Python version: 3.12.4
Command: garmindb_cli.py --all --download --import --analyze --latest
<- Downloads data Removed for brevity ->
Error:
___Analyzing Data___
Summary Tables Generation:
Traceback (most recent call last):
File "C:\Users\username\AppData\Local\Programs\Python\Python312\Scripts\garmindb_cli.py", line 368, in <module>
main(sys.argv[1:])
File "C:\Users\username\AppData\Local\Programs\Python\Python312\Scripts\garmindb_cli.py", line 355, in main
analyze_data(args.trace)
File "C:\Users\username\AppData\Local\Programs\Python\Python312\Scripts\garmindb_cli.py", line 248, in analyze_data
analyze.summary()
File "C:\Users\username\AppData\Local\Programs\Python\Python312\Lib\site-packages\garmindb\analyze.py", line 192, in summary
for year in sorted(list(set(Monitoring.get_years(self.garmin_mon_db) + Activities.get_years(self.garmin_act_db)))):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'int' and 'NoneType'
I ended up finding issue #163 which pointed me in the right direction.
I had 16 rows in my activities table that were completely blank.
View:
select start_time from activities where start_time IS NULL;
Delete:
DELETE from activities WHERE start_time IS NULL;
I don't have a lot of experience with python so I may be way off base, but could you filter out null or empty datetimes in the get_years() method/function?
It should:
@classmethod def get_years(cls, db): """Return a list of the unique years present in the time column.""" with db.managed_session() as session: return cls._rows_to_ints_not_none(session.query(extract('year', cls.time_col)).distinct().all())
_rows_to_ints_not_none should do that. It needs some debugging to see why it isn't working as intended.