0

I'm using Jupyter Lab with ancaconda to schedule some Jupyter Notebooks.

I installed jupyterlab_scheduler and when I try to schedule a cronjob I get the error "There was an error submitting job".

My cron syntax is 1 14 * * * and the command for the job is jupyter nbconvert --to notebook --execute C:/Users/charl/conversion rates sdr.ipynb

My log looks like this :

[E 2022-06-06 14:21:15.410 ServerApp] Uncaught exception POST /jupyterlab_scheduler/add?1654539675407 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/jupyterlab_scheduler/add?1654539675407', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
  File "c:\users\charl\anaconda3\lib\site-packages\tornado\web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "c:\users\charl\anaconda3\lib\site-packages\tornado\web.py", line 3173, in wrapper
    return method(self, *args, **kwargs)
  File "c:\users\charl\anaconda3\lib\site-packages\jupyterlab_scheduler\handlers.py", line 114, in post
    with CronTab(user=os.environ["USER"]) as cron:
  File "c:\users\charl\anaconda3\lib\os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'USER'
[W 2022-06-06 14:21:15.412 ServerApp] Unhandled error
[E 2022-06-06 14:21:15.414 ServerApp] {
  "Host": "localhost:8888",
  "Accept": "*/*",
  "Referer": "http://localhost:8888/lab",
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36"
}
[E 2022-06-06 14:21:15.415 ServerApp] 500 POST /jupyterlab_scheduler/add?1654539675407 (::1) 
3.99ms referer=http://localhost:8888/lab

1 Answers1

0

The stack trace is saying that the environment variable USER is not found. USER is defined by default if you are using Linux, but not if you are using Windows.

It appears that the package is designed for Linux users. You can get around this particular issue by defining the USER environment variable manually.

tnwei
  • 860
  • 7
  • 15