Closed MDKPredator closed 3 years ago
Might this somehow be a related issue?
I don't think so, it seems that the modification date does not always exist. I have not managed to replicate the error, but it could be easily fixed by modifying in the "_human_readable_times" method:
m_secs = int(modification)/1000
By
m_secs = 0 if modification is None else int(modification)/1000
More canonically:
m_secs = int(modification)/1000 if modification else 0
A sensible failsafe indeed.
The original issue of LastUploadTime
may need some thought. There is in fact only one goal there and criterion for testing, namely that when we upload a file, then ask Degoo for the file properties (including the upload time) that this time can be compared meaningfully to the local filesystem's reported modifcation time for the file.
So in testing it, timezones are only relevant if one or the other is not UTC. Which I suspect is the case, namely that the local file modification time is in local time, but the reported upload time by Degoo is in UTC. So to make them comparable, a timezone conversion is needed.
This error occurs when trying to upload a file with a time zone other than UTC (in my case +1). The problem is in the has_changed method, specifically when trying to calculate LastUploadTime:
LastUploadTime = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=tz.UTC).astimezone(tz.tzlocal()) # Internally it tries to subtract 0 - 3600, which causes the exception
I think this can be fixed by changing the following, working on Windows as on Ubuntu:
LastUploadTime = datetime.datetime.now(tz.tzlocal())