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

load_resource_description fails when passing absolute paths #228

Closed
constantinpape opened this issue Sep 1, 2021 · 2 comments
Closed

load_resource_description fails when passing absolute paths #228

constantinpape opened this issue Sep 1, 2021 · 2 comments

Comments

@constantinpape
Copy link
Collaborator

constantinpape commented Sep 1, 2021

See the following code snippet, run in the same folder as "DSB-Nuclei-AffinityModel.zip", which is a valid model zip.
Note that the first call works fine, the second one (which has the correct abs path) fails with the stack track below.

from bioimageio.spec import load_resource_description
load_resource_description("DSB-Nuclei-AffinityModel.zip")                                                                                                                                                      
load_resource_description("/home/pape/Work/data/dsb/new/models/DSB-Nuclei-AffinityModel.zip")                                                                                                                                                  
ValueError                                Traceback (most recent call last)                                                                                                                                                                            
~/Work/bioimageio/spec-bioimage-io/bioimageio/spec/shared/fields.py in _deserialize(self, value, attr, data, **kwargs)                                                                                                                                 
    433         try:                                                                                                                                                                                                                                   
--> 434             return raw_nodes.URI(uri_string=value)                                                                                                                                                                                             
    435         except Exception as e:                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                       
~/Work/bioimageio/spec-bioimage-io/bioimageio/spec/shared/raw_nodes.py in __init__(self, uri_string, scheme, authority, path, query, fragment)                                                                                                         
                                                                                                                                                                                                                                                       
~/Work/bioimageio/spec-bioimage-io/bioimageio/spec/shared/base_nodes.py in __post_init__(self, uri_string)                                                                                                                                             
    100         ):                                                                                                                                                                                                                                     
--> 101             raise ValueError("Invalid URI or relative path. (use URI with scheme 'file' for absolute file paths)")                                                                                                                             
    102                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                       
ValueError: Invalid URI or relative path. (use URI with scheme 'file' for absolute file paths)
@constantinpape
Copy link
Collaborator Author

Passing the file path as pathlib.Path instead of str also works with absolute paths.

@FynnBe
Copy link
Member

FynnBe commented Sep 9, 2021

this should be fixed now, please reopen if not

@FynnBe FynnBe closed this as completed Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants