simonepri / fitbit2garmin

⬇ Downloads lifetime Fitbit data and exports it into the format supported by Garmin Connect data importer. This includes historical body composition data (weight, BMI, and fat percentage), activity data (calories burned, steps, distance, active minutes, and floors climbed), and individual GPS exercises (TCX).
MIT License
46 stars 3 forks source link

Error after fetching activity log list #1

Closed lesaff closed 11 months ago

lesaff commented 11 months ago

@simonepri Thanks for creating such a useful tool!

I got this error while running an export with start and end date.

OS: MacOS Sonoma 14.1 Python version: 3.11.6

Thanks! Rudy

INFO:root:Activity log list fetched.
Traceback (most recent call last):
  File "/opt/homebrew/bin/fitbit2garmin", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/fitbit2garmin/cli.py", line 161, in run
    cli()
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/fitbit2garmin/cli.py", line 27, in wrapper
    loop.run_until_complete(func(**kwargs))
  File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/fitbit2garmin/cli.py", line 156, in dump_all
    await commands.dump_activity_tcx(cache_directory, directory, start_date, end_date)
  File "/opt/homebrew/lib/python3.11/site-packages/fitbit2garmin/commands.py", line 89, in dump_activity_tcx
    with activity_log_file_path.open("rbU") as fr:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rbU'
simonepri commented 11 months ago

It should be fixed now, can you try re-installing the package and run the command again? As long as you didn't deleted the data previously produced, it should just continue from where it died.

lesaff commented 11 months ago

Your fix works! Thanks!