cull_idle_servers syntax error

52 views
Skip to first unread message

d...@deej.net

unread,
Apr 24, 2018, 1:56:32 PM4/24/18
to Project Jupyter
I'm trying to setup the cull idle service, and am running into the following error:

[I 2018-04-24 13:52:44.679 JupyterHub service:266] Starting service 'cull-idle': ['python3', '/etc/jupyterhub/cull_idle_servers.py', '--timeout=3600']
[I 2018-04-24 13:52:44.682 JupyterHub service:109] Spawning python3 /etc/jupyterhub/cull_idle_servers.py --timeout=3600
  File "/etc/jupyterhub/cull_idle_servers.py", line 78
    return f"{h:02}:{m:02}:{seconds:02}"
                                       ^
SyntaxError: invalid syntax


Running it directly from the command line returns the same error.

# python3 cull_idle_servers.py
  File "cull_idle_servers.py", line 78
    return f"{h:02}:{m:02}:{seconds:02}"
                                       ^
SyntaxError: invalid syntax


This is using the current file downloaded today from https://github.com/jupyterhub/jupyterhub/blob/master/examples/cull-idle/cull_idle_servers.py

Has anyone else run into this and have suggestions?

Thanks,

-Dj

Tim Head

unread,
Apr 24, 2018, 2:20:54 PM4/24/18
to jup...@googlegroups.com
Hi,


On Tue, Apr 24, 2018 at 7:56 PM <d...@deej.net> wrote:
I'm trying to setup the cull idle service, and am running into the following error: 

[I 2018-04-24 13:52:44.679 JupyterHub service:266] Starting service 'cull-idle': ['python3', '/etc/jupyterhub/cull_idle_servers.py', '--timeout=3600']
[I 2018-04-24 13:52:44.682 JupyterHub service:109] Spawning python3 /etc/jupyterhub/cull_idle_servers.py --timeout=3600
  File "/etc/jupyterhub/cull_idle_servers.py", line 78
    return f"{h:02}:{m:02}:{seconds:02}"
                                       ^
SyntaxError: invalid syntax


The cull_idle_servers.py script requires Python 3.6. It uses a new feature called fstrings (https://docs.python.org/3/whatsnew/3.6.html#pep-498-formatted-string-literals

T

d...@deej.net

unread,
Apr 24, 2018, 2:24:11 PM4/24/18
to Project Jupyter
Thanks, Tim, that would explain it.  We only have Python 3.4.8 available. 
Any chance there is an older version of the script that works with 3.4?
-Dj

d...@deej.net

unread,
Apr 27, 2018, 10:36:28 AM4/27/18
to Project Jupyter
As a followup to this, I ended up installing Python 3.6 via the Software Collections (we are running Centos 7.x), and am calling the script external to the Jupyterhub service using an API key and it is working fine as far as I can tell.

Thanks for the assist!

-Dj


Reply all
Reply to author
Forward
0 new messages