geo-activity-playground icon indicating copy to clipboard operation
geo-activity-playground copied to clipboard

AttributeError: 'float' object has no attribute 'magnitude'

Open michael-hatz opened this issue 4 months ago • 1 comments

Hi,

I've setup 0.29.1 on Win11 and it does work using the archive import. Then I tried to setup the Strava API and afterwards I'm getting this error trying when the server is starting and trying to get Strava activities:

I:\geoactivity>python -m geo_activity_playground serve
Detect deleted activities: 0it [00:00, ?it/s]
Parse activity metadata (serially): 0it [00:00, ?it/s]
Collate activity metadata: 0it [00:00, ?it/s]
Downloading Strava activities: 4it [00:01,  2.11it/s]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\__main__.py", line 118, in <module>
    main()
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\__main__.py", line 91, in main
    options.func(options)
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\__main__.py", line 67, in <lambda>
    *make_activity_repository(options.basedir, options.skip_reload),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\__main__.py", line 106, in make_activity_repository
    scan_for_activities(repository, tile_visit_accessor, config_accessor())
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\webui\upload\controller.py", line 111, in scan_for_activities
    import_from_strava_api(config)
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\importers\strava_api.py", line 72, in import_from_strava_api
    while try_import_strava(config):
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Michael\AppData\Local\Programs\Python\Python311\Lib\site-packages\geo_activity_playground\importers\strava_api.py", line 140, in try_import_strava
    "distance_km": activity.distance.magnitude / 1000,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'float' object has no attribute 'magnitude'
2024-10-05 08:42:06 py.warnings WARNING sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=2908, family=23, type=1, proto=0, laddr=('2003:c3:2f04:b700:45f6:b8b2:725e:27d', 49726, 0, 0), raddr=('2600:9000:26da:1200:1f:5eea:9700:93a1', 443, 0, 0)>


I:\geoactivity>pause

michael-hatz avatar Oct 05 '24 06:10 michael-hatz