jpmorganchase/jupyter-fs

`'coroutine' object has no attribute 'pop'` if copy/paste files in JupyterLab file browser

jeflem opened this issue · 1 comments

jeflem commented

Describe the bug
If jupyterfs is installed copying a file in JLab's file browser, then pasting it results in a message "Paste Error, unknown error". Logs show 'coroutine' object has no attribute 'pop' (details below). Seems to be closely related to #179. Pasted file does not appear. This behavior is observed in JLab's standard file browser as well as in jupyterfs' file browsers.

To Reproduce
Steps to reproduce the behavior:

  1. Install JupyterLab and jupyterfs and add some jupyterfs resource (osfs://~for instance).
  2. Right-click a file in one of the file browsers (standard or jupyterfs), then 'Copy'.
  3. Paste the file in the same file browser (right-click, then 'Paste').
  4. Error message appears, but not the pasted file.

Expected behavior
Copy/Paste works as intended.

Desktop (please complete the following information):

  • OS: Debian 12 (Bookworm)
  • Browser: Firefox 102.14.0esr
  • JupyterLab 4.0.7
  • jupyterfs 0.4.0

Log output

[I 2023-11-05 05:26:37.285 ServerApp] Copying c6ae85f5:test.txt to /c6ae85f5:test
[E 2023-11-05 05:26:37.285 ServerApp] Uncaught exception POST /user/u3/api/contents/c6ae85f5%3Atest?1699158397267 (::ffff:10.0.2.100)
    HTTPServerRequest(protocol='http', host='192.168.178.28:8000', method='POST', uri='/user/u3/api/contents/c6ae85f5%3Atest?1699158397267', version='HTTP/1.1', remote_ip='::ffff:10.0.2.100')
    Traceback (most recent call last):
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/web.py", line 1786, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 225, in post
        await self._copy(copy_from, path)
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 163, in _copy
        model = await ensure_async(self.contents_manager.copy(copy_from, copy_to))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 189, in ensure_async
        result = await obj
                 ^^^^^^^^^
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyterfs/metamanager.py", line 174, in copy
        model.pop("path", None)
        ^^^^^^^^^
    AttributeError: 'coroutine' object has no attribute 'pop'
[W 2023-11-05 05:26:37.290 ServerApp] wrote error: 'Unhandled error'
    Traceback (most recent call last):
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/tornado/web.py", line 1786, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 225, in post
        await self._copy(copy_from, path)
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 163, in _copy
        model = await ensure_async(self.contents_manager.copy(copy_from, copy_to))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyter_core/utils/__init__.py", line 189, in ensure_async
        result = await obj
                 ^^^^^^^^^
      File "/opt/conda/envs/jhub/lib/python3.11/site-packages/jupyterfs/metamanager.py", line 174, in copy
        model.pop("path", None)
        ^^^^^^^^^
    AttributeError: 'coroutine' object has no attribute 'pop'
[E 2023-11-05 05:26:37.292 ServerApp] {
      "X-Forwarded-Host": "192.168.178.28:8000",
      "X-Forwarded-Proto": "http",
      "X-Forwarded-Port": "8000",
      "X-Forwarded-For": "::ffff:10.0.2.100",
      "Cache-Control": "no-cache",
      "Pragma": "no-cache",
      "Cookie": "_xsrf=[secret]; jupyterhub-user-u3=[secret]; MoodleSession=[secret]; jupyterhub-session-id=[secret]; MOODLEID1_=[secret]",
      "Connection": "keep-alive",
      "Dnt": "1",
      "Content-Length": "33",
      "Origin": "http://192.168.178.28:8000",
      "X-Xsrftoken": "2|c88916b8|350eac33f9745caf75955a1495ec032f|1698553303",
      "Authorization": "token [secret]",
      "Content-Type": "text/plain;charset=UTF-8",
      "Referer": "http://192.168.178.28:8000/user/u3/lab",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept": "*/*",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0",
      "Host": "192.168.178.28:8000"
    }
[E 2023-11-05 05:26:37.293 ServerApp] 500 POST /user/u3/api/contents/c6ae85f5%3Atest?1699158397267 (u3@::ffff:10.0.2.100) 11.01ms

Duplicate