Tensorboard: Work around `fromtimestamp(0)` bug in Windows Python 3.6.0…3.6.6

Created on 16 Mar 2019  Â·  4Comments  Â·  Source: tensorflow/tensorboard

See #1976.

backend bug

Most helpful comment

@stefanbschneider: That downgrades you to a version of TensorBoard prior
to the notebook integration features. You should be able to safely
upgrade to TensorBoard 1.14, which has both the features and the fix.

All 4 comments

For the record, I’ve attempted to do this a few times and given up each
time, because I can’t find a good way to implement strftime("%s")
portably. Using (dt - EPOCH).total_seconds() (the current code) is not
correct because it incorporates daylight savings time…

>>> fts = datetime.datetime.fromtimestamp
>>> (fts(9971999) - fts(0)).total_seconds()
9971999.0
>>> (fts(9971999 + 1) - fts(0)).total_seconds()
9975600.0

In Python 3, datetime.timezone.utc looks like it should at least
provide the foundations to solve these issues, but without adding a
pytz dependency we don’t have a Python 2 equivalent, and the code to
backport is not trivial (I checked).

I might just throw up my hands and replace everything in Python memory
with bare ints-since-epoch. At least then we just have time.time() to
get the real value and str/int for serialization—no syscalls, no OS
errors. I guess I’m just not Dutch enough for this one. *sigh*

Actually, this was a quick and easy solution for me: https://github.com/tensorflow/tensorboard/issues/1976#issuecomment-471834147

pip install tensorboard==1.12.2

@stefanbschneider: That downgrades you to a version of TensorBoard prior
to the notebook integration features. You should be able to safely
upgrade to TensorBoard 1.14, which has both the features and the fix.

Perfect, thanks!

Was this page helpful?
0 / 5 - 0 ratings