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

upload_files_to_datastore() fails if only one file is uploaded #388

Open
oliverbeagley opened this issue Aug 27, 2020 · 1 comment
Open
Labels
bug-fix documentation Improvements or additions to documentation

Comments

@oliverbeagley
Copy link

Describe the bug
upload_files_to_datastore() fails if a length 1 character vector is used.

This is likely due to reticulate converting length 1 vectors to scalars rather than to a length 1 list.

To Reproduce

library(azuremlsdk)
workspace <- load_workspace_from_config()
datastore <- get_datastore(workspace, "workspaceblobstore")

upload_files_to_datastore(datastore = datastore, files = "test")
#>  Error in py_call_impl(callable, dots$args, dots$keywords) : 
#>   UserErrorException: UserErrorException:
#>     Message: 't' does not point to a file. Please upload the file to cloud first if running in a cloud notebook.
#>     InnerException None
#>     ErrorResponse 
#> {
#>     "error": {
#>         "code": "UserError",
#>         "message": "'t' does not point to a file. Please upload the file to cloud first if running in a cloud notebook."
#>     }
#> } 

Using a list instead works eg

upload_files_to_datastore(datastore = datastore, files = list("test"))

Expected behavior

For the function to work with single files.

Wrapping the files argument in as.list() before internally calling datastore$upload_files() might be a possible fix

@diondrapeck
Copy link
Member

Thank you, @oliverbeagley! We'll make a work item to make the documentation and behavior consistent with each other.

@diondrapeck diondrapeck reopened this Aug 27, 2020
@diondrapeck diondrapeck added bug-fix documentation Improvements or additions to documentation labels Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants