Hi,
I am new to both Napari and Imagesc, so I am not sure this is the right place to ask this. I am writing a plugin with magicgui, and I want to select a folder using a FileEdit widget. It works fine if I set up the code to open a file using the option {‘mode’: ‘r’}, but I get an error if use the option {‘mode’: ‘d’} to open a folder. More precisely, using this code:
import pathlib
from magicgui import magicgui
@magicgui(fn={'mode': 'd'}, call_button='Run')
def widget(fn = pathlib.Path.home()):
print(fn)
widget.show(run=True)
I get the following error:
Traceback (most recent call last):
File “/home/aurelien/anaconda3/envs/napari-env/lib/python3.8/site-packages/magicgui/widgets/_bases/value_widget.py”, line 44, in
lambda *x: self.changed(value=x[0] if x else None)
File “/home/aurelien/anaconda3/envs/napari-env/lib/python3.8/site-packages/magicgui/events.py”, line 603, in call
self._invoke_callback(cb, event)
File “/home/aurelien/anaconda3/envs/napari-env/lib/python3.8/site-packages/magicgui/events.py”, line 621, in _invoke_callback
_handle_exception(
File “/home/aurelien/anaconda3/envs/napari-env/lib/python3.8/site-packages/magicgui/events.py”, line 619, in _invoke_callback
cb(event)
File “/home/aurelien/anaconda3/envs/napari-env/lib/python3.8/site-packages/magicgui/widgets/_concrete.py”, line 423, in _on_choose_clicked
result = self._show_file_dialog(
File “/home/aurelien/anaconda3/envs/napari-env/lib/python3.8/site-packages/magicgui/backends/_qtpy/widgets.py”, line 549, in show_file_dialog
result = show_dialog(*args)
TypeError: getExistingDirectory(parent: QWidget = None, caption: str = ‘’, directory: str = ‘’, options: Union[QFileDialog.Options, QFileDialog.Option] = QFileDialog.ShowDirsOnly): argument 4 has unexpected type ‘NoneType’
Does anyone know how I could fix this?
Edit: I am running napari 0.4.5 on Ubuntu 18.04