tcgoetz / GarminDB

Download and parse data from Garmin Connect or a Garmin watch, FitBit CSV, and MS Health CSV files into and analyze data in Sqlite serverless databases with Jupyter notebooks.
GNU General Public License v2.0
1.11k stars 137 forks source link

Error running garmin.py --analyze #58

Closed FL6 closed 11 months ago

FL6 commented 4 years ago

System: Debian 10 I don't have a GarminConnect account and want to use the device FIT files only.

  1. I git-cloned the repository,
  2. did "make setup",
  3. used the example json config
  4. and put my FIT files into ~/HealthData/FitFiles/ directory.
  5. Since "make" stops because the credentials for GarminConnect login are wrong, "./garmin.py --all --import" fills the DBs,
  6. but "./garmin.py --analyze" fails with the following error:

fl6@localhost:~/projects/GarminDB$ python3 garmin.py --analyze Analyzing Data Traceback (most recent call last): File "garmin.py", line 341, in main(sys.argv[1:]) File "garmin.py", line 328, in main analyze_data(args.trace) File "garmin.py", line 235, in analyze_data analyze = Analyze(db_params_dict, debug - 1) File "/home/fl6/projects/GarminDB/analyze_garmin.py", line 38, in init self.unit_strings = Fit.units.unit_strings[self.measurement_system] TypeError: hash method should return an integer

I reproduced the same error with the above steps in a fresh installed virtualbox Ubuntu environment.

tcgoetz commented 4 years ago

Sorry for the slow response. I've been otherwise occupied.

The problem is that your DB does not have an entry in the Attributes table for measurement_system. Those entries come from device messages currently. Not all Fit files have device messages. I will enhance the code to also set the measurement_system attribute from the user_profile message.

tcgoetz commented 4 years ago

Can you try with the develop branch and see if it fixes you issue?

FL6 commented 4 years ago

Thanks for the response, i got the same error with the fix, but after playing around a bit, I found out that apparently placing the FIT files in the HealthData/FitFiles dir is not sufficient. I did ./garmin.py --import --all --copy with the GARMIN dir in GarminConnectConfig.json . I got FileNotFoundError for the GARMIN/garmin/settings directory, the query seems to be case sensitive, since my Forerunner 30 files/directories are all in capitals. I changed SETTINGS, ACTIVITY and MONITOR to lower case and added 'sleep' directory and --copy command was successful. After that --analyze runs without error.

tcgoetz commented 4 years ago

The capitalization is not consistent between watches. I will think about a solution.