Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception due to missing file #352

Closed
reservoirinvest opened this issue Jul 29, 2024 · 6 comments · Fixed by #353
Closed

Uncaught exception due to missing file #352

reservoirinvest opened this issue Jul 29, 2024 · 6 comments · Fixed by #353
Labels
bug Something isn't working

Comments

@reservoirinvest
Copy link

Uncaught exception GET /jupyterlab_code_formatter

  File "~\python\nse\.venv\Lib\site-packages\tornado\web.py", line 1788, in _execute
    result = method(*self.path_args, **self.path_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\python\nse\.venv\Lib\site-packages\tornado\web.py", line 3301, in wrapper
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\python\nse\.venv\Lib\site-packages\jupyterlab_code_formatter\handlers.py", line 18, in get
    "formatters": {
                  ^
  File "~\python\nse\.venv\Lib\site-packages\jupyterlab_code_formatter\handlers.py", line 20, in <dictcomp>
    "enabled": formatter.cached_importable if use_cache else formatter.importable,
                                                             ^^^^^^^^^^^^^^^^^^^^
  File "~\python\nse\.venv\Lib\site-packages\jupyterlab_code_formatter\formatters.py", line 364, in importable
    package_location = subprocess.run(
                       ^^^^^^^^^^^^^^^
  File "~\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "~\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

[W 2024-07-30 01:55:58.738 ServerApp] wrote error: 'Unhandled error'
Traceback (most recent call last):
File "\python\nse.venv\Lib\site-packages\tornado\web.py", line 1788, in _execute
result = method(*self.path_args, **self.path_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
\python\nse.venv\Lib\site-packages\tornado\web.py", line 3301, in wrapper
return method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\python\nse.venv\Lib\site-packages\jupyterlab_code_formatter\handlers.py", line 18, in get
"formatters": {
^
File "
\python\nse.venv\Lib\site-packages\jupyterlab_code_formatter\handlers.py", line 20, in
"enabled": formatter.cached_importable if use_cache else formatter.importable,
^^^^^^^^^^^^^^^^^^^^
File "\python\nse.venv\Lib\site-packages\jupyterlab_code_formatter\formatters.py", line 364, in importable
package_location = subprocess.run(
^^^^^^^^^^^^^^^
File "
\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "
\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

@reservoirinvest reservoirinvest added the bug Something isn't working label Jul 29, 2024
@st-bender
Copy link

Hi there,
The same problem on Linux.
But the message is a bit more specific:

FileNotFoundError: [Errno 2] No such file or directory: 'Rscript'

HTH.

@ctcjab
Copy link

ctcjab commented Aug 7, 2024

I am also seeing this: After customizing the jupyter-minimal-notebook base image to include this extension out-of-the-box, along with black, isort, and ruff, now the following gets logged by this extension every time the JupyterLab UI is loaded:

2024-08-07 13:43:42,934 - ServerApp - ERROR - Uncaught exception GET /jupyterlab_code_formatter/formatters?1723038222929 (192.168.65.1)
HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='GET', uri='/jupyterlab_code_formatter/formatters?1723038222929', version='HTTP/1.1', remote_ip='192.168.65.1')
Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1788, in _execute
    result = method(*self.path_args, **self.path_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 3301, in wrapper
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/jupyterlab_code_formatter/handlers.py", line 18, in get
    "formatters": {
                  ^
  File "/opt/conda/lib/python3.11/site-packages/jupyterlab_code_formatter/handlers.py", line 20, in <dictcomp>
    "enabled": formatter.cached_importable if use_cache else formatter.importable,
                                                             ^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/jupyterlab_code_formatter/formatters.py", line 364, in importable
    package_location = subprocess.run(
                       ^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/conda/lib/python3.11/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'Rscript'
[W 2024-08-07 13:43:42.937 ServerApp] wrote error: 'Unhandled error'

I have no need for R so I don't want to install Rscript just to avoid this log spam. Hopefully it's easy enough to change this code to catch and handle this exception gracefully.

@ctcjab
Copy link

ctcjab commented Aug 7, 2024

Thanks for the quick fix! And thanks for maintaining this extension. ❤️

@ctcjab
Copy link

ctcjab commented Aug 7, 2024

I'll look out for the next release so I can test it when it's out, and post back here if I see anything unexpected.

@krassowski
Copy link
Contributor

@ctcjab and others, can you confirm that this is fixed after installing the latest release v3.0.1? It is already on PyPI, will be on conda-forge soon.

@ctcjab
Copy link

ctcjab commented Aug 7, 2024

Confirmed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants