Calling the plug-in reader function on url results in error message instead of a file download:
File ~/Documents/GitHub/napari-flim-phasor-plotter/src/napari_flim_phasor_plotter/_reader.py:25, in napari_get_reader(path='https://zenodo.org/record/7656540/files/2a_FLIM_single_image.ptu')
12 """A basic implementation of a Reader contribution.
13
14 Parameters
(...)
23 same path or list of paths, and returns a list of layer data tuples.
24 """
---> 25 file_extension = get_most_frequent_file_extension(path)
path = 'https://zenodo.org/record/7656540/files/2a_FLIM_single_image.ptu'
26 # If we recognize the format, we return the actual reader function
File ~/Documents/GitHub/napari-flim-phasor-plotter/src/napari_flim_phasor_plotter/_reader.py:126, in get_most_frequent_file_extension(path=PosixPath('https:/zenodo.org/record/7656540/files/2a_FLIM_single_image.ptu'))
125 # Get most frequent file entension in path
--> 126 most_frequent_file_type = max(set(suffixes), key=suffixes.count)
127 return most_frequent_file_type
UnboundLocalError: local variable 'suffixes' referenced before assignment
Thanks for reporting! We need to add a condition that handles urls, nice catch!
Maybe using urlparse, from which we could get a path and then the file extension if it is a single file. It it is a .zip, then it is probably a folder.
Calling the plug-in reader function on url results in error message instead of a file download: