jupyter / jupyter/notebook

Timestamp comparision with and without timezone information

Open
#4,258 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

On mybinder.org we are seeing errors like the following from the notebook. It seems to be harmless (doesn't bother users). Do you know if this has been fixed in 5.7.x or should I make a PR?
```
[E 07:34:16.024 NotebookApp] Exception in callback >
Traceback (most recent call last):
File "/srv/conda/lib/python3.6/site-packages/tornado/ioloop.py", line 1026, in _run
return self.callback()
File "/srv/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 1579, in shutdown_no_activity
(utcnow() - self.web_app.last_activity()).total_seconds()
File "/srv/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 372, in last_activity
return max(sources)
TypeError: can't compare offset-naive and offset-aware datetimes
```

We are (still) on notebook 5.6.0.

Contributor guide

Open the contributing guide

Research direction

Start with notebook/notebookapp.py, especially NotebookApp.shutdown_no_activity and last_activity, and trace the timestamp sources shown in the traceback. Reproduce the mixed timezone-aware and timezone-naive comparison on the reported version; done means the callback no longer raises this TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.