You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue type (bug report or feature request): Feature Request Operating system (e.g. Fedora 24, Mac OS 10.11, Windows 10): RedHat 7 Platform (e.g. 64-bit x86, 32-bit ARM): 64-bit x86 OpenSlide Python version (openslide.__version__): 1.1.2 OpenSlide version (openslide.__library_version__): 3.4.1 Slide format (e.g. SVS, NDPI, MRXS): SVS
---------------------------------------------------------------------------
ArgumentError Traceback (most recent call last)
<ipython-input-12-415293724eed>in<module>
----> 1 slide = openslide.open_slide(Path("/path/to/slide/slide.svs"))
~/anaconda3/envs/nic/lib/python3.7/site-packages/openslide/__init__.py in open_slide(filename)
386 object for other types of images.""" 387 try:--> 388 return OpenSlide(filename) 389 except OpenSlideUnsupportedFormatError: 390 return ImageSlide(filename)~/anaconda3/envs/nic/lib/python3.7/site-packages/openslide/__init__.py in __init__(self, filename) 158 AbstractSlide.__init__(self) 159 self._filename = filename--> 160 self._osr = lowlevel.open(filename) 161 162 def __repr__(self):ArgumentError: argument 1: <class 'TypeError'>: Incorrect type
My opinion is that this error message is not really readable to understand the user error. My proposal is to include the expected type and the actual type (and / or the name of the variable failing) in the message. I think this could be really helpful when debugging:
Side note:
I really appreciate pathlib package and I think that supporting it could help other users.
I could open another issue if you share the feeling.
The text was updated successfully, but these errors were encountered:
lorenz-gorini
changed the title
Unclear Error message when using pathlib.Path instance as open_slide argument
Unclear error message when using pathlib.Path instance as open_slide argument
Feb 9, 2021
Context
Issue type (bug report or feature request): Feature Request
Operating system (e.g. Fedora 24, Mac OS 10.11, Windows 10): RedHat 7
Platform (e.g. 64-bit x86, 32-bit ARM): 64-bit x86
OpenSlide Python version (
openslide.__version__
): 1.1.2OpenSlide version (
openslide.__library_version__
): 3.4.1Slide format (e.g. SVS, NDPI, MRXS): SVS
Details
When the user wants to open a slide, he can use:
but he can't provide the path as a
pathlib.Path
instance:This raises the following error:
My opinion is that this error message is not really readable to understand the user error.
My proposal is to include the expected type and the actual type (and / or the name of the variable failing) in the message. I think this could be really helpful when debugging:
Side note:
I really appreciate
pathlib
package and I think that supporting it could help other users.I could open another issue if you share the feeling.
The text was updated successfully, but these errors were encountered: