I'm trying to fix an error that keeps popping up for some scripts I built. What I'm basically doing is retrieving some data from a Postgres database which includes a timestamptz field.
When I process that data, I sometimes get the following error:
ValueError: time data '2020-04-23T13:03:49.911533+00:00' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'
The code where it happens:
last_seen_at_date = datetime.strptime(dict['last_seen_at'],'%Y-%m-%dT%H:%M:%S.%f%z').date()
What I don't understand is how this can happen. When I copy paste this string and use it as a variable then convert it to a date, it works perfectly.
Edit: Realized that this is working well on my Mac but not on my severs running on Ubuntu. Not sure how to fix this.
Any idea on what's happening?
Thank you,