question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: can't compare offset-naive and offset-aware datetimes

See original GitHub issue

I try to generate a poster with some gpx files extracted from my garmin account. I have downloaded the files using the proposed python script garmin-connect-export. Now, I get the following error:

Traceback (most recent call last):
  File "~/GpxTrackPoster/venv/bin/create_poster", line 8, in <module>
    sys.exit(main())
  File "~/GpxTrackPoster/venv/lib/python3.7/site-packages/gpxtrackposter/cli.py", line 217, in main
    tracks = loader.load_tracks(args.gpx_dir)
  File "~/GpxTrackPoster/venv/lib/python3.7/site-packages/gpxtrackposter/track_loader.py", line 114, in load_tracks
    return self._filter_and_merge_tracks(tracks)
  File "~/GpxTrackPoster/venv/lib/python3.7/site-packages/gpxtrackposter/track_loader.py", line 169, in _filter_and_merge_tracks
    tracks = self._merge_tracks(tracks)
  File "~/GpxTrackPoster/venv/lib/python3.7/site-packages/gpxtrackposter/track_loader.py", line 176, in _merge_tracks
    tracks = sorted(tracks, key=lambda t1: t1.start_time())
TypeError: can't compare offset-naive and offset-aware datetimes

Is something wrong with my gpx files? As said, they all come from the same source.

Thanks in advance, LT.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lowtowercommented, Feb 23, 2021

Thanks for Your quick reply!

The modification did work! I get some errors for only a few gpx files such as:

Error while loading ~/2020/activity_5702364393.gpx: Track has no start or end time.

I have to have a closer look at these files.

Thanks a lot, cheers, LT

0reactions
lowtowercommented, Feb 23, 2021

I checked the relevant gpx files - they were not “running” files but “cardio” without time info - so the error messages are reasonable.

Thanks for Your help and filing the pr!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't compare naive and aware datetime.now() <= challenge ...
So the way I would solve this problem is to make sure the two datetimes are in the right timezone.
Read more >
Comparing Datetimes in Python with and without Timezones
In this tutorial, we'll go over how to compare dates in Python, ... TypeError: can't compare offset-naive and offset-aware datetimes.
Read more >
can't compare offset-naive and offset-aware datetimes - Reddit
I asked a question similar to this before but I didn't understand the answers given. What timezone were the bare timestamps taken in?...
Read more >
PYTHON : django 1.4 - can't compare offset-naive ... - YouTube
PYTHON : django 1.4 - can't compare offset - naive and offset - aware datetimes [ Gift : Animated Search Engine ...
Read more >
can't compare offset-naive and offset-aware datetimes #266
I'm using pypicloud with gcs storage and redis cache. When clicking "Rebuild package list" in the admin UI I'm getting TypeError: can't compare...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found