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

TypeError: object bool can't be used in 'await' expression #61

Closed
yjoer opened this issue Oct 3, 2024 · 2 comments
Closed

TypeError: object bool can't be used in 'await' expression #61

yjoer opened this issue Oct 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@yjoer
Copy link
Contributor

yjoer commented Oct 3, 2024

Description

I am using JupyterLab v4.2.5 and v2.0.0 of the extension. It turns out that is_hidden(...) returned a boolean instead of an awaitable object. I found that Jupyter Server instantiated a synchronous contents manager instead of an async alternative. I removed the await keyword in L42 and the opener starts working correctly. A safer solution might be using ensure_async(...) as in the upstream handlers.

Reproduce

  1. Activate the quick open dialog.
  2. Type anything.
  3. Find the error message in the terminal.

Expected behavior

It should return a list of files without errors.

Context

  • Python package version: 3.11.9
  • Extension version: v2.0.0
  • Operating System and its version: Ubuntu 22.04.5 LTS
  • Browser and its version: Chrome 129
Command Line Output
[W 2024-10-03 22:36:10.945 ServerApp] wrote error: 'Unhandled error'
    Traceback (most recent call last):
      File "/home/ubuntu/camp/.venv/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/home/ubuntu/camp/.venv/lib/python3.11/site-packages/jupyterlab_quickopen/handler.py", line 83, in get
        contents_by_path = await self.scan_disk(full_path, excludes)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/ubuntu/camp/.venv/lib/python3.11/site-packages/jupyterlab_quickopen/handler.py", line 51, in scan_disk
        if await self.should_hide(entry, excludes):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+     File "/home/ubuntu/camp/.venv/lib/python3.11/site-packages/jupyterlab_quickopen/handler.py", line 42, in should_hide
+       self.contents_manager.is_hidden(entry.path)
    TypeError: object bool can't be used in 'await' expression
@yjoer yjoer added the bug Something isn't working label Oct 3, 2024
@jtpio
Copy link
Member

jtpio commented Oct 8, 2024

Thanks @yjoer for the report.

Would you like to open a draft PR to try fixing this? Thanks!

@yjoer
Copy link
Contributor Author

yjoer commented Oct 8, 2024

I created a draft PR in #62 with a more precise finding.

@yjoer yjoer closed this as completed Oct 9, 2024
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

No branches or pull requests

2 participants