{"id":8237,"library":"ipyfilechooser","title":"IPyFileChooser","description":"IPyFileChooser is a Python file chooser widget designed for use in Jupyter/IPython notebooks, integrating with `ipywidgets`. It allows users to interactively select file paths and filenames. The library is actively maintained, with its latest stable version 0.6.0 released in September 2021.","status":"active","version":"0.6.0","language":"en","source_language":"en","source_url":"https://github.com/crahan/ipyfilechooser","tags":["jupyter","ipywidgets","file-chooser","notebook","gui"],"install":[{"cmd":"pip install ipyfilechooser","lang":"bash","label":"PyPI"},{"cmd":"conda install -c conda-forge ipyfilechooser","lang":"bash","label":"Conda-forge"}],"dependencies":[{"reason":"Core dependency for Jupyter/IPython widget functionality.","package":"ipywidgets","optional":false}],"imports":[{"symbol":"FileChooser","correct":"from ipyfilechooser import FileChooser"}],"quickstart":{"code":"import os\nfrom ipyfilechooser import FileChooser\nfrom IPython.display import display\n\n# Get the current working directory as the default path\ncurrent_dir = os.getcwd()\n\n# Create and display a FileChooser widget\n# You can specify a default path, filename, and filter patterns\nfc = FileChooser(current_dir, title='Choose a file:')\nfc.filter_pattern = ['*.txt', '*.csv'] # Example: filter for text and CSV files\ndisplay(fc)\n\n# To access the selected path and filename after user interaction\n# For example, after a button click or callback\n# print(f\"Selected Path: {fc.selected_path}\")\n# print(f\"Selected Filename: {fc.selected_filename}\")\n# print(f\"Full Selected File: {fc.selected}\")\n\n# Example of using a callback function\ndef on_selection_change(chooser):\n    print(f\"Callback triggered! Selected: {chooser.selected}\")\n\nfc.register_callback(on_selection_change)","lang":"python","description":"This quickstart demonstrates how to initialize and display the `FileChooser` widget in a Jupyter environment. It sets a default path, applies a file filter, and shows how to access the selected file properties. An example of registering a callback function for dynamic responses to user selections is also included."},"warnings":[{"fix":"Update your code to use `fc.dir_icon = 'icon_string'` (e.g., '📁') and `fc.dir_icon_append = True/False` instead of `use_dir_icons`.","message":"In `v0.6.0`, the `use_dir_icons` property was replaced by `dir_icon` and `dir_icon_append` for customizing folder icons. Direct usage of `use_dir_icons` will result in an `AttributeError`.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Ensure `ipywidgets` is installed and extensions are enabled. For Jupyter Notebook: `jupyter nbextension enable --py --sys-prefix widgetsnbextension`. For JupyterLab: `jupyter labextension install @jupyter-widgets/jupyterlab-manager` followed by `jupyter lab build`. In Docker contexts, building JupyterLab inside the Dockerfile is often essential.","message":"For the widget to display correctly in Jupyter environments (Notebook or Lab), `ipywidgets` extensions must be properly enabled. In JupyterLab, a rebuild might be necessary after installation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that `filter_pattern` will match regardless of case. If strict case-sensitive filtering is required, apply an additional programmatic filter after `fc.selected_filename` has been retrieved.","message":"Since `v0.4.4`, `filter_pattern` values are treated as case-insensitive. This behavior might differ from expectations on case-sensitive file systems if strict case matching is desired.","severity":"gotcha","affected_versions":">=0.4.4"},{"fix":"Consider using `ipywidgets.interactive_output` or manually connecting a callback function using `fc.register_callback(my_function)` or `fc.observe(my_function, names='selected')` for more robust interaction.","message":"If using `ipywidgets.interact` with `ipyfilechooser`, the interact functionality might not update as expected due to significant changes in `ipywidgets` since `ipyfilechooser`'s last major updates.","severity":"deprecated","affected_versions":"Potentially all versions when used with recent `ipywidgets`"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"For Jupyter Notebook: `jupyter nbextension enable --py --sys-prefix widgetsnbextension`. For JupyterLab: `jupyter labextension install @jupyter-widgets/jupyterlab-manager` and then `jupyter lab build`. In Docker environments, building JupyterLab within the Dockerfile often solves this.","cause":"Jupyter Notebook/Lab extensions for ipywidgets are not correctly installed or enabled, or JupyterLab needs a rebuild.","error":"Failed to load model class 'VBoxModel' from module '@jupyter-widgets/controls' (or widget simply not displaying)."},{"fix":"Use `dir_icon` and `dir_icon_append` instead. Example: `fc.dir_icon = '📁'` and `fc.dir_icon_append = True` to customize folder icons.","cause":"Attempting to use the `use_dir_icons` property which was removed in `v0.6.0`.","error":"AttributeError: 'FileChooser' object has no attribute 'use_dir_icons'"},{"fix":"Verify that the specified path exists and has appropriate read/write permissions for the user running the Jupyter kernel. Use `os.path.exists()` to check programmatically before initializing `FileChooser`.","cause":"The `default_path`, `sandbox_path`, or other path provided to `FileChooser` does not exist or is not accessible by the Jupyter kernel's user.","error":"FileNotFoundError: [Errno 2] No such file or directory: '/non_existent_path'"}]}